Hello!
On Tue, Mar 17, 2015 at 3:55 AM, Alexander Altshuler wrote:
> Aerospike client is active. It performs regular network activities on its
> own.
> Aerospike C Client API spawn some threads for this purpose.
>
> There is also Aerospike libevent C API which is able to run single thread,
> but main loop should be libevent.
>
> So we cannot just use cosocket API. Am I right?
>
I didn't suggest you reuse the existing C library. Rewriting the
driver in Lua atop cosockets is almost always easier.
> One possible approach:
> Spawn OS thread for every nginx worker and run main loop by libevent. This
> thread will do all internal jobs to communicate with cluster and
> also will be intermediary (using unix socket for example) with nginx worker
> process.
This is sub-optimal (extra OS threads) and complicated (OS thread
synchronization).
> May be it is possible to write nginx C module to run Aerospike client
> completely in context of nginx worker?
Even for nginx C module development, reusing existing C library is
harder than coding the client from scratch (though still much harder
than the cosocket Lua approach). Just see the ngx_drizzle module for
MySQL (using libdrizzle) and ngx_postgres module for PostgreSQL (using
libpq) for evidences.
Regards,
-agentzh