0

I use celery for doing snmp requests with easysnmp library which have a C interface. The problem is lots of time is being wasted on I/O. I know that I should use eventlet or gevent in this kind of situations, but I don't know how to handle patching a third party library when it uses C extensions.

dirn
  • 19,454
  • 5
  • 69
  • 74
Mehdi Pourfar
  • 488
  • 4
  • 13

1 Answers1

1

Eventlet and gevent can't monkey-patch C code.

You can offload blocking calls to OS threads with eventlet.tpool.execute(library.io_func)

temoto
  • 5,394
  • 3
  • 34
  • 50