We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36398
    • 13 Posts
    Hy, i use Modx with xPDO and i love it. But i see that xpdo needs longer and more cpu to get my results as mysql. I made a test from inside modx i created a snippet that give me some results from my db, and the same as select under mysql. my page trow a memory error with xpdo after 10-15 seconds. But mysql give me the results in less then a second. What can i do to geht xpdo faster and use less CPU powser. My complete page needs much cpu power with site cached and a lot with site cached. There is no difference if xpdo is cached or not.

    Is there something to calculate the speed of modx? I think i have seen some code i could insert into my page that will show me the time for php and mysql to generate the side but i can not find it anymore, cn someone help me?

    Thanks
      • 33968
      • 863 Posts
      Hi there

      I include the following in my site header when developing:
      MySql: [^qt^] s, [^q^] request(s), PHP: [^p^] s, total: [^t^] s, document retrieved from [^s^].
      

      Which should give you something like:
      MySql: 0.0002 s s, 1 request(s), PHP: 0.2493 s s, total: 0.2495 s s, document retrieved from database.

      However the mySql figures are I think a bit misleading due to the xPDO layer.

      There's also Executioner which you can use to wrap individual snippets to see how long they take to execute.

      Please do share your findings and if you need help benchmarking I would be happy to help. I'm really interested in performance. Right now I'm trying to figure out why (cached) pages are loading 10x slower on the production server than on MAMP, it's driving me insane.
        • 36398
        • 13 Posts
        Ok after testing some sites i get this results on different sites.

        MySql: 0.0000 s s, 0 request(s), PHP: 3.0543 s s, total: 3.0543 s s, document retrieved from database
        MySql: 0.0000 s s, 0 request(s), PHP: 2.9014 s s, total: 2.9014 s s, document retrieved from database
        MySql: 0.0002 s s, 1 request(s), PHP: 1.1549 s s, total: 1.1551 s s, document retrieved from database
        MySql: 0.0065 s s, 2 request(s), PHP: 7.4073 s s, total: 7.4138 s s, document retrieved from database
        MySql: 0.0036 s s, 2 request(s), PHP: 3.2129 s s, total: 3.2165 s s, document retrieved from database

        A site with a clean template needs 10% of Server CPU, thats to much.

        My snippet run in less than 0.1 second.

        My database is not as big as other sites of me it hast on site_content 48.728 Rows and site_tmplvar_contentvalues 200.952. Is that to much for modx??? Like i said on other page of me i have the count of rows but it runs with less CPU Power.

        The biggest problem for me is that my Server CPU is going to 90% if i open an uncached site and 20-25% on cached sites. The Server runs Centos6, PHP 5.3.2 with APC, Mysql 5.1.52 with 2.6Ghz and 4GB Ram. Other applications i wrote with a lot of more pages and bigger databases are generatet in less then a second and cpu of 0.6%. That was before Modx and now it need much more power? How can i handle it? Has anyone an idea? Fast CGI has the same CPU Problem.
          • 33968
          • 863 Posts
          Servers are not my strong point so someone else will have to chime in. But I'm really interested.

          Also - I wouldn't say that nearly 49k rows is 'too much', but it is certainly a lot. Do you need to store your data in resources or could you look into some custom tables instead?
            • 36398
            • 13 Posts
            I need resources because every row is a page in my site smiley
              • 22303 MODX Staff
              • 10,725 Posts
              First of all, what version of MODX are you running? And what are you benchmarking? The queries executed through xPDO take no longer than queries through the mysql extension, so this is not the issue. You having almost 50,000 Resources certainly could be though and we can explore how you can better scale your site when you are managing this many Resources.

              FWIW, if you have not upgraded to a MODX 2.1.x release, you will have performance issues with that many Resources.
                • 36398
                • 13 Posts
                Sorry i knew i missed some info smiley

                I use modx Revo 2.1.1
                i have 156 Snippets
                and 100 Chunks
                and 69 TVs
                for the complete page

                @opengeek i hope you have some tips for me to handle this big site because it is growing every day and i need the cpu power to handle more visitors smiley

                Thanks for help
                  • 33968
                  • 863 Posts
                  i have 156 Snippets
                  and 100 Chunks
                  and 69 TVs
                  for the complete page
                  That's all on one page? I think I misunderstood smiley
                  Can you provide an example template for the page you are testing?
                    • 36398
                    • 13 Posts
                    That is for the complete Site not for one single page
                      • 33968
                      • 863 Posts
                      Made any progress with this?

                      Tell you what - try those tags out on a blank page with blank template. No snippets or content at all, just see how long it takes modx to grab a page:

                      MySql: [^qt^] s, [^q^] request(s), PHP: [^p^] s, total: [^t^] s, document retrieved from [^s^].


                      I'm getting this at the moment for a blank template, Revo 2.1.3. It's on a shared server (I'm about to upgrade to a VPS), but I'm curious that an Evo site on the same server is getting much better results.
                      Revo:
                      MySql: 0.0000 s s, 0 request(s), PHP: 0.9279 s s, total: 0.9279 s s, document retrieved from database.
                      MySql: 0.0000 s s, 0 request(s), PHP: 0.7066 s s, total: 0.7066 s s, document retrieved from cache.
                      
                      Evo site:
                      MySql: 0.0033 s s, 2 request(s), PHP: 0.1057 s s, total: 0.1090 s s, document retrieved from database.
                      MySql: 0.0023 s s, 0 request(s), PHP: 0.0956 s s, total: 0.0978 s s, document retrieved from cache.