Oracle ocilib Support ?

255 views
Skip to first unread message

Daniel Rios

unread,
Jul 28, 2013, 11:00:35 PM7/28/13
to openre...@googlegroups.com
Hello there!
Do you have plans for Oracle support ? Would be great to see this library supported:

http://orclib.sourceforge.net/ 



Yichun Zhang (agentzh)

unread,
Jul 29, 2013, 12:11:03 AM7/29/13
to openresty-en
Hello!
Well, it seems to me that this is just an encapsulation layer atop
Oracle's OCI library, which is not so interesting for Nginx
integration (I don't know to what extend it exposes OCI's nonblocking
API or whether it exposes at all).

Two or three years ago, chaoslawful tried to integrate OCI into the
nginx core via OCI's (incomplete) nonblocking API in a similar fashion
to the existing ngx_drizzle and ngx_postgres modules. His ngx_oracle
module was never completed (nor published) AFAIK due to the following
difficulties IIRC:

1. Unlike libpq (for Pg) and libdrizzle (for MySQL and Drizzle), the
nonblocking API exposed by OCI is not complete. Certain operations
must be blocking and we have to introduce OS threads to workaround
them.

2. OCI's advanced features require more aggressive use of multiple
connection fds, making external event loops (based on
epoll/poll/kqueue/etc) much harder to control.

3. OCI is not opensource, making it much harder to work-around
limitations of OCI, unlike libpq and libdrizzle.

Best regards,
-agentzh

Yichun Zhang (agentzh)

unread,
Aug 9, 2013, 2:31:31 AM8/9/13
to Daniel Rios, openresty-en
Hello!

On Thu, Aug 8, 2013 at 8:03 PM, Daniel Rios wrote:
> Thanks a lot for the explanation , was very concise. But as I understand lua
> can call c modules an libs, so it is possible to use this lib ?

No, you need to integrate all the network I/O into the Nginx event
loop, otherwise your Lua code will surely block the (single-threaded)
Nginx worker processes, and ruin the performance of everything. You
surely don't want your Nginx downgrade to an Apache httpd with its
prefork mpm.

See how ngx_drizzle integrates libdrizzle's nonblocking API for MySQL
into the nginx event model,

https://github.com/chaoslawful/drizzle-nginx-module

and also how ngx_postgres integrates libpq's nonblocking API for PostgreSQL:

https://github.com/FRiCKLE/ngx_postgres

Basically, you need to hook your C library's nonblocking API into the
Nginx event model, normally as an Nginx upstream module.

Alternatively, you can re-implement the wire protocol atop ngx_lua's
nonblocking cosocket API with pure Lua:

http://wiki.nginx.org/HttpLuaModule#ngx.socket.tcp

Such examples are the lua-resty-mysql and lua-resty-memcached libraries:

https://github.com/agentzh/lua-resty-mysql
https://github.com/agentzh/lua-resty-memcached

But the Oracle wire protocol is not open AFAIK, so it could be hard to
take this pure Lua approach.

Regards,
-agentzh

P.S. I'm cc'ing the openresty-en mailing list:
https://groups.google.com/group/openresty-en
Reply all
Reply to author
Forward
0 new messages