Rewrite lookup via MySQL table

agentzh agentzh at gmail.com
Mon Aug 30 07:20:55 MSD 2010


On Sat, Aug 28, 2010 at 8:54 PM, relix <nginx-forum at nginx.us> wrote:
> First of all, this thread contains a lot of information! I'm in the
> process of implementing something similar and it has helped me a ton.
>
> I was just wondering, as long as you're using Lua anyway, why not do
> away with Drizzle completely, and just make Lua connect to the database
> to retrieve the correct URL?

Lua's database library will block the nginx process which is
unacceptable for real world applications. ngx_drizzle is served as a
non-blocking mysql driver component for Lua here (of cause, it can
also work with ngx_http_js_module and others).

> Is it because Drizzle will keep one
> connection to the database per nginx-instance, so there is less
> overhead,

Actually ngx_drizzle can keep connection pools to mysql backends per
nginx instance. One db connection per process is the suboptimal
PHP/Perl way of doing things and it can waste a lot of database
resources.

> compared to Lua which would have to connect and disconnect to
> the database for every request?
>

MUCH more than just that ;)

Cheers,
-agentzh



More information about the nginx mailing list