I am working on a turbogears app and decided to test the different
methods of deploying an app and I'm a little concerned. Since this
app requires SSL, and paster doesn't handle SSL, what are the
suggested methods for deployment?
Paster gives reasonably good performance during development for a
single user, however, I cannot use SSL with Paster.
mod_wsgi appears to work ok until there are multiple requests coming
in and response times on reloaded pages falls off considerably. I
don't believe I would have too many issues with this application, but,
a reasonably successful site would appear to have issues even without
SSL.
How is
turbogears.org set up? mod_wsgi behind mpm-prefork? or mpm-
worker?
apachebench on a very simple test, hitting a page that requires
authentication, 100 requests, no keepalives, no concurrent connections
comes up with:
paster: Requests per second: Requests per second: 76.32 [#/sec]
(mean)
apache2-mpm-prefork Requests per second: 57.38 [#/sec] (mean)
apache2-mpm-worker Requests per second: 89.98 [#/sec] (mean)
As a baseline that is relatively decent. The current php application
we're running is at: Requests per second: 72.51 [#/sec] (mean) on
lesser hardware.
If we bump up the concurrency, we start to run into issues:
At 10 concurrent requests, we get the following:
paster: Requests per second: 52.94 [#/sec] (mean)
apache2-mpm-prefork: Requests per second: 54.45 [#/sec] (mean)
apache2-mpm-worker: Requests per second: 53.61 [#/sec] (mean)
whereas our php application with 10 concurrent sessions is at:
Requests per second: 62.35 [#/sec] (mean).
If we test 100 concurrent requests, mpm-worker really shines through
by staying at roughly Requests per second: 53.46 [#/sec] (mean) and
paster comes through with Requests per second: 54.85 [#/sec] (mean)
These results don't come close to the Requests per second: 86.33 [#/
sec] (mean) at
http://turbogears.org/2.0/ Since you have ServerTokens
set to prod, I couldn't really guess how you had deployed the site.
Since you use Discus, I'm assuming Identity is turned off.
So even with slight concurrency, mod_wsgi (or PasteWSGIServer/0.5) is
taking a rather huge hit. Unless I have missed something obvious with
the testing, writing a scaleable application with TurboGears is going
to require considerable server resources.
A quick test to check mod_wsgi performance on my setup resulted in:
Requests per second: 2370.11 [#/sec] (mean)
Concurrency set to 20, 1000 requests. Even at 50 or 100 concurrent
requests, the numbers don't change that dramatically.
This seems to suggest the load isn't from mod_wsgi, but from TG2.
What have I done differently than the Turbogears site? Even without
authentication, with 10 concurrent requests I cannot get my
installation anywhere near 86.33 requests per second even on fairly
powerful hardware (X3220 @ 2.40GHz, quadcore, 8gb ram) The only way
I could come close to the 86.33 was to run the app on a 2 server
cluster.
I have yet to try nginx/mod_wsgi, but, I believe my results might be
similar. Apache was not configured to serve static images. Since
apachebench only pulled a single page without any stylesheets/images,
the test should mimic a properly configured setup by testing only the
response time that turbogears took to check to see if the current
session was authenticated and presented a login page.
What deployment options are there?
paster
proxy -> paster
apache2-mpm-prefork -> mod_wsgi
apache2-mpm-worker -> mod_wsgi
nginx -> mod_wsgi
apache2 -> mod_python - run the entire virtualenvironment within
mod_python?
Based on the numbers above, apache2-mpm-worker appears to give me the
flexibility to allow TG2 to handle only the pages it needs while
apache serves the static content.
For a site that will see 100k unique visitors with 4-5 pageviews a
person a day, what bottlenecks should I expect?
The site
shootq.com which is linked from the frontpage of
turbogears.org/2.0 as a site using TG2 in production appears to be
using CakePHP as their framework. Does anyone use TurboGears on a
forward-facing website? What issues have you run into? How did you
deploy and what type of traffic are you seeing?