понедельник, 16 марта 2015 г., 21:56:21 UTC+3 пользователь agentzh написал:
Hello!
On Mon, Mar 16, 2015 at 3:34 AM, Vincent MADY wrote:
> agentzh, do you plan to add an Aerospike driver in the official roadmap ?
Not really. I'd like to rely on the community to work on such things :)
> So far it is possible to wrap the Aerospike C Client API so it can be called
> from Lua but as this C Client API is synchronous, it impacts badly on the
> overall performances (more information here :
> http://www.aerospike.com/community/labs/aerospike_lua_client.html)
>
Take a look at existing lua-resty-* libraries based on the ngx_lua
cosocket API, like lua-resty-mysql and lua-resty-redis. Usually it
should be quite straightforward.
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?
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.
In this way we may use cosocket API and make our client unblocking with price of additional thread per worker.
May be it is possible to write nginx C module to run Aerospike client completely in context of nginx worker?
Say like single-threaded version of Aerospike libevent C AP, but main loop will be nginx.
What do you think about?
Regards,
Alexander Altshuler