0

In a web game built on Turbogears v2.1.5, logged-in users POST a 16-byte message periodically. The server CPU reaches 100% when the POST rate is 60 POSTs-per-second. (For testing, we have removed all work such as updating the DB with each post-- the server simply returns an empty response immediately.)

Using wrk to GET a 16-byte static file we see Turbogears reaching rates of ~500 requests-per-second and want to match or get close to that rate with our game's POSTs. We'd really like to be at 1,000 or more POSTs per second.

Setup: Turbogears v2.1.5, AWS c3.large, Windows Server 2008 R2, Intel Xeon, E5-2680 v2 @ 2.8Ghz 2.8Ghz.

Question: Are there tg2 settings or other changes that would let us in this scenario handle 500 or more POSTs-per-second?

web20
  • 3
  • 1

1 Answers1

1

If you are able to upgrade to TG2.3 the work in the more recent releases greatly improved the framework performances ( http://blog.axant.it/archives/452 ) out of the box.

Also through the new minimal mode introduced in 2.3 ( http://turbogears.readthedocs.io/en/latest/turbogears/minimal/index.html ) you can easily disable any component you don't need like i18n, sessions etc.. for more speed improvements ( see the various X.enabled options at http://turbogears.readthedocs.io/en/latest/reference/config-options.html ). Disabling i18n and static files support usually gives a good performance boost.

amol
  • 1,771
  • 1
  • 11
  • 15
  • Thank you - will try to upgrade and your other helpful suggestions. Would you expect any performance difference resulting from using python2 vs python3? (Currently using python2.) – web20 Feb 27 '17 at 16:08
  • A follow-up -- since the main activity here is POSTing a response, does i18n or static files have any impact on the performance? It seems like neither would touch a json data POST. I could see how sessions would impact performance, but it is important to know which user is POSTing the data so disabling that may not be an option. – web20 Mar 01 '17 at 17:05
  • An update: we've ported the relevant parts of our web game to TG2.3. On Ubuntu and Windows seeing peak ~100 POSTs per second. However, if the "authtkt" cookie is _not_ sent we see ~700 POSTs per second on Ubuntu and ~580 on Windows. The 3 or so identity-related database queries cause a significant slowdown (yet we do need to know which user is making the POSTs). Help/ideas to reach 1,000+ POSTs per second (with user identity information per post) are welcomed! – web20 Mar 03 '17 at 21:19
  • See http://turbogears.readthedocs.io/en/latest/cookbook/advanced_caching.html#caching-authentication that might help you. Also consider disabling static files support if you don't use them, each request needs to check on disk if a file with that name exists if they are enabled. – amol Mar 08 '17 at 15:51