On 11/20/2011 07:20 AM, Roberto De Ioris wrote:
> 
>>
>> My problem is, that every first django request to a worker will be very
>> slow as this is only when django starts importing its modules.
>>
>>
>> I  would like to get rid of this delay (force the imports for each
>> worker prior to the first request amde to it)
>>
>> I fhound following link:
>> http://lists.unbit.it/pipermail/uwsgi/2011-May/001980.html
>>
>> which suggests to force a fake request.
>>
>> The thread also mentions, that chain loading might be a solution
>>
>> So now my question.
>> What is the recommended way to prime all django worker threads? (I'm
>> currently at 0.9.8, though I will switch soon to to 0.9.9.2)
>>
>> Thanks in advance for your feedback
>>
> 
> 
> One of my customer is doing this to force django loading on startup:
> 
> from django.core.handlers.wsgi import WSGIHandler
> 
> application = WSGIHandler()
> 
> # generate a fake request
> application({'REQUEST_METHOD':'GET', 'PATH_INFO':'/',
> 'SERVER_NAME':'foobar'}, uwsgi.start_response)
> 
> 
> I do not remember if some other variable is needed, you can eventually add
> them in the dictionary if you receive an error.
> 
Thanks a lot. I'll try this


_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to