Below is an excerpt about horizontal scaling from Chapter 13 in the book. 
Has any one successfully implemented this using web2py?

It is also possible to connect to different databases depending on the 
requested action or controller. In a master-slave database configuration, 
*some* *action performs only a read* and *some performs both read/write*. 
The former can safely connect to a slave db server, while the latter should 
connect to a master. So you can do:


1 
2
3
4
5
6

if request.function in read_only_actions:
   db = DAL(sample(['mysql://...1','mysql://...2','mysql://...3'], 3))elif 
request.action in read_only_actions:
   db = DAL(shuffle(['mysql://...1','mysql://...2','mysql://...3']))else:
   db = DAL(sample(['mysql://...3','mysql://...4','mysql://...5'], 3))


where 1,2,3 are slaves and 3,4,5 are masters.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to