How about to use memcache on the same host to share data between processes?

Andriy


________________________________
> From: [email protected] 
> Date: Fri, 17 May 2013 11:57:30 -0700 
> To: [email protected] 
> Subject: [uWSGI] sharing objects amongst workers 
> 
> We are using the pymongo driver with mongodb and as it stands, it looks 
> like each worker gets its own connection. Is there any way to share a 
> database connection in memory among the workers? I've read about ksm 
> on the readthedocs page, is that applicable here? 
> 
> We also have a bunch of python objects being stored in memory, would 
> KSM be helpful in sharing memory among the workers for this? 
> 
> For example: 
> Currently we have an identical list being stored on each worker (we 
> keep the list stored in a python variable because its large and we need 
> to access it quickly so storing in the uwsgi cache and pickling and 
> unpickling (the only way I can think of to store a python object in the 
> cache) each request, would be too slow) and we have 6 workers. This 
> means we are using several times the memory we actually need to. Is 
> there any way to share a global python object among all of the workers? 
> All we do is read from it, we only modify it when we are completely 
> refreshing it periodically. 
> 
> The overarching question is, how do i share db connections and python 
> objects globally, so each worker doesn't need to have their own copy of 
> the python objects and we aren't keeping so many db connections open? 
> 
> _______________________________________________ uWSGI mailing list 
> [email protected] 
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi                          
>           
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to