Seán Hayes
Seán Hayes

Reputation: 4360

Prevent greenthread switch in eventlet

I have a Django/Tastypie app where I've monkey patched everything with eventlet.

I analysed performance during load tests while using both sync and eventlet worker clasees for gunicorn. I tested against sync workers to eliminate the effects of waiting for other greenthreads to switch back, and I found that the memcached calls in my throttling code only take about 1ms on their own. Rather than switch to another greenthread while waiting for this 1ms response, I'd rather just block at this one point. Is there some way to tell eventlet to not switch to another greenthread? Maybe a context manager or something?

Upvotes: 1

Views: 437

Answers (1)

temoto
temoto

Reputation: 5577

There is no such context manager, though you are welcome to contribute one.

You have monkey patched everything, but you do not want to monkey patch socket in memcache client. Your options:

  • monkey patch everything but socket, then patcher.import_patched particular modules. This is going to be very hard with Django/Tastypie.
  • modify your memcache client to use eventlet.patcher.original('socket')

Upvotes: 1

Related Questions