Large number of file descriptors results in failure

Hi @bateau020, thanks for your detailed explanation. I think I should not use the term FIFO here. Anyway, I am trying to use async mode now. Since messing the libevent’s event loop with ATS internal event loop is complicative and unknown, I plan to use couchbase with libevent in two threads way. Create an event base and share it with two threads, use lcb_get in one thread, run event_base_loop in other thread. Per the libevent’s doc (Re: [Libevent-users] event_add from a different thread while event loop is running), it seems an event base can be shared with multiple threads (but only one thread runs the event_base_loop) if evthread_use_pthreads api is called. But base on @avsej’s comment “if you are going to run event loop (with the my_get_callback()) in one thread, but schedule the GET operations from the another thread (calling lcb_get(…)), you will get issues” on (C API - Are callbacks done synchronously or asynchronously? - #2 by avsej) and the comment of function lcb_create_libevent_io_opts “@param base the event base (struct event_base *) to hook use (please note that you shouldn’t reference the event base from multiple threads)” (libcouchbase/plugins/io/libevent/libevent_io_opts.h at master · couchbase/libcouchbase · GitHub), it seems that my two threads way can’t work correctly. Do you @bateau020 @avsej have suggestions here? Thanks.