Welcome! Log In Create A New Profile


Re: Catch ALL requests by LUA-script

May 04, 2011 08:05PM
> Your feedback is always welcome! Sorry for the
> delay on my side for I
> was enjoying my vocation in the Fuzhou city in the
> southern region of
> China in the last few days :)

Heh, I know what delays are and that was no delay.. Here it is best weather for bicycling, so i do all the time! ;) One thing on my todo is to visit china, my cousin lived there past 5-6 years and i've seen many pictures and videos.. Last month he married his wife there, but i could not get away :(

> What's your operating system? We used to observe
> similar periodic
> segfaults with exactly the same version of
> ngx_openresty on RedHat
> Enterprise Linux (RHEL) 5.4 in production but now

My good *old* development box is a quad *i686* with deb5 (old)stable gcc 4.3.2-1.1

> all is fine after we
> switched LuaJIT to a more recent git HEAD version
> which includes an
> important work-around for an old libgcc bug
> explained here in the
> lua-l mailing list:
> http://lua-users.org/lists/lua-l/2011-03/msg00576.
> html

Tried both samples and luajit detected it. Anyway thank you for sharing this, so ill try that next.

> I'll make a new release of ngx_openresty to
> include a new version of
> LuaJIT as well as some other modules' updates like
> ngx_lua's and
> ngx_srcache's. I'll inform you here when I'm done.
> Also, it'll be very appreciated if you can obtain
> a gdb backtrace for
> your segfaults so that we can look at the details
> ;)

Sure, thats no problem. Tomorrow ill attach to it and take a sample for you. Have also a full dump, as every build has its own /prefix.

> Oh, that's awesome :)

Thanks, but yours is *epic*.

> >
> > Below ill use luasql, instead you can use
> > ngx.location.capture("/some-internal-rds-json")
> and lua-yajl, but this
> > approach ends as soon as you want INSERT
> followed by LAST_INSERT_ID() or
> > other complex queries/transactions (as long as
> libdrizzle has no support
> > for multiple queries, maybe this is not the best
> option to go with, ive
> > tried alternatives and workarounds, but for now
> this is what *I* want).
> >
> The luasql library will certainly block nginx
> worker processes. Please
> dont' use that.

Tbh, youre absolutely right. Realized it before i used this and *I* had no problems, also do not have much inserts (about 25-40k text each, stored in a fraction of a second). Tested it also further with luasql all queries, no problems so far but only with circumventions and all under pre-calculated conditions with *enough* instances, fast i/o, caching etc. This is at no will a reliable solution and much likely a show-stopper! So do *not* try at home eh?!!

In the meantime or maybe forever ill stick to redis only (: Exchanges to or from intermediates are stressing me, but still better as seeing ruby eating up resources and doing "nothing" on ngx_passenger/ree.. sinatra, merb, rails, foo, bla -.-" Redis helped there a lot, but even in my *experimental* Rack written with D ive done better! ;) But thats true another story..

As a last resort for mysql i thought of getting an unique id from a (lua) location which is then used for insertion and afterwards on success, i.e. for redirects. Or have i missed something, what would you do?

> I know libdrizzle is very limited in terms of
> functionality and it's
> *not* maintained very well. We'll start a
> completely new nginx
> upstream modules for mysql named ngx_mysql by
> implementing a
> non-blocking full-fledged highly-optimized mysql
> client from scratch.
> I'd love to see it happen this year ;)
> Another direction we're taking is to introduce the
> "cosocket"
> mechanism into ngx_lua such that one can use a
> *synchronous* Lua
> socket API that is transparently *asynchronous*
> and *non-blocking* on
> the nginx C level. Atop that, we can build
> pure-Lua non-blocking mysql
> client driver and thus putting everything onto the
> Lua land and no
> longer need to mess up the nginx.conf file and
> nginx subrequests. I'd
> also want to see it happen by this Christmas ;)

You mentioned "cosocket" somewhere (github?) already and IMO that would be really amazing! I'm following "agentzh" and "chaoslawful" on github and will take a deeper look when i get more time. Will be linking to your projects when i release something useful (safe) for it.

> The high-level abstraction for ngx_lua is
> excellent! We're taking a
> slightly different approach along the line in our
> web applications:
> http://agentzh.org/misc/nginx/lzsql-manual.html
> We're using a DSL (Domain Specific Language)
> compiler that emits Lua
> code and business logic is mostly implemented in
> this DSL. It's
> targeting our business though, not meant to be
> useful for general web
> application development (yet).

Looks very promising, i seen that page already on my researches and would love to get my hands on it. I do a lot of research, trying as much as possible, protocols like XMPP and PSYC and such good things, but mostly everything apart from PHP, .Net and Java.. :>

> Thanks for sharing!
> -agentzh

Heh. >.< All the thanks belong to you and who else is also behind that projects! Had so much *fun* with it so far, you wont believe it how it boosted everything at our groups site, ookeh not *that* much, but enough to already left ruby (was riding since little rails). And personally it helped me alot to grok lua, as i needed that for deeper reworks of my prosody-im fork (another lua project thats awesome, i prefer it over ejabberd/erl which indeed is both neat feature-wise, but wont let me change (easily) from mnesia to redis or other nice tricks).

Thanks again!
Subject Author Posted

Catch ALL requests by LUA-script

andiL March 01, 2011 02:34AM

Re: Catch ALL requests by LUA-script

agentzh March 01, 2011 03:42AM

Re: Catch ALL requests by LUA-script

andiL March 01, 2011 04:53AM

Re: Catch ALL requests by LUA-script

agentzh March 01, 2011 06:14AM

Re: Catch ALL requests by LUA-script

andiL March 01, 2011 07:52AM

Re: Catch ALL requests by LUA-script

HowToMeetLadies May 02, 2011 12:11AM

Re: Catch ALL requests by LUA-script

agentzh May 03, 2011 10:56PM

Re: Catch ALL requests by LUA-script

HowToMeetLadies May 04, 2011 08:05PM

Re: Catch ALL requests by LUA-script

HowToMeetLadies May 05, 2011 12:29PM

Re: Catch ALL requests by LUA-script

agentzh May 04, 2011 11:22PM

Re: Catch ALL requests by LUA-script

agentzh May 06, 2011 12:28AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 66
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready