On Oct 16, 9:13 pm, Jerre <[email protected]> wrote: > Hey Folks! > > So we've developed a CakePHP (1.3) application and it is currently > live in production (www.fom.be). > However there seems to be some performance issues regarding the CPU > load with multiple simultaneous requests. > The website is for an event which takes place 2 times a year. Between > the events, there is little traffic to the website, but during the > events we expect 10.000 requests/day (for 3 days).
That isn't exactly a lot of traffic. > During our last > event (where we first tested the site), we often got server timeouts. > > We have a live production server (which is a VPS), a test environment > (which is on a shared webhost, and debug = 2), and we've also done > some performance testing on a local server, on which we simulate the > production server on a VPS. > > A first issue we have is the slowness of CakePHP, it takes 317ms > before we receive the first answer from the webserver That time includes dns resolution, network latency + *your app code*. The latter being the most important part. > (measured with > 'Inspect Element' in Google Chrome > -http://gyazo.com/27ab6d8158627e7026296d19ba26bcb1.png). > We've implemented caching, What kind of caching > added indexes to our database tables, > debugmode = 0, removed link() functions (which came up to be very slow > after debugging with XDebug) That was probably a mistake > > Another issue seems to be some kind of apache/php configuration issue: > Using ab (http://httpd.apache.org/docs/2.0/programs/ab.html) we got > the following test results: > > Test environment (www.de-raedt.eu/fomsitenew) > Dualcore E2200 600Mhz, 4GB RAM, we suspect CentOS (we don't know the > actual configuration) > concurrent connections requests / s > 1 13,77 > 2 12,07 > 3 37,88 > 4 23,62 > 5 63,61 > 7 75 > 10 70 > 20 95 > > Production environment (www.fom.be) > VPS with Debian 6.0.2, 1 core, 3GHz, 1GB RAM (QEMU Virtual CPU 0.12.3) > concurrent connections requests / s > 1 1,1 > 2 1,52 > 3 1,84 > 4 1,86 > 5 1,82 > 7 1,76 > 10 2,06 > 20 1,52 > Here we see 100% CPU usage on almost every testing that we > did.http://gyazo.com/efc60112417b79d65023e35ce2b719d5.png The point of a siege test is to load the system, getting 100% cpu usage means your code is cpu-bound (which probably means you've got it doing /a lot/ of work on all requests). > > So we were wondering what configuration on the Testing environment (of > which we don't have full access to, it's on a shared webhost) may > cause these differences. There are a lot of potential reasons, and not all of them are related to apache setup (infact, most of them are related to code). > It seems that the webserver succeeds in > scaling the website for many users? > Even with the better test results of our Testing environment, we still > feel like the number of simultaneous connections is very limited, is > this normal? > > We're very curious about your suggestions! Have you checked the php and app logs for error messages? Do requests for e.g. / read from cache or talk to the db? If GET requests, especially from anon users generate db queries - that's the first thing you want to change. https://github.com/mcurry/html_cache <- most likely the sort of caching you need/want Any request that starts a session will block all other requests that start a session (for the same user). If you use ab - you need access to the environment to be able to see/ tweak things and see results (i.e. do it locally). Some low-effort solutions that hide poor php code performance: http://www.slideshare.net/caillou/varnish-lightning-talk https://twitter.com/#!/mattalkingshit/status/124782270883180544 AD PS - new site (?), XHTML 1.0 strict and tables? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
