Chapter 18.5.1. Scaling Sessions

If you are using sessions, and you need to scale to multiple machines, fortunately all is not lost. If you’re using sessions in your application, all you have to do is make sure that a user will keep getting session data across multiple requests. There are two basic ways to go about achieving that goal:

  • Regardless of which machine the request goes to, the TurboGears process has access to the session data.

  • The request for that user always goes to the same TurboGears process.

You can achieve the first option by storing the session data in a database. Then all you have to do is connect all your TurboGears processes to the same database. Alternatively, sessions can be stored in files and the filesystem could be ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.