Welcome! Log In Create A New Profile

Advanced

Add C code in configuration?

Sparsh Gupta
May 10, 2012 03:20PM
Hello

I am using nginx as a reverse proxy in front of my Varnish servers. I have
to do some operations on request URL to make a key before passing it to
Varnish. The main operations will be:

1. Extract value of GET parameter 'a' and lookup 'keya' in memcache
server. If keya is not found in memcache, look it up in mysql
2. Extract value of GET parameter 'b' and do some preg_replace operations
on it to clean it up.
3. The potential value of 'keya' will basically be a set of key-values
(array) and I have to iterate over them and for each item match
(preg_match) the key of the item with value of 'keya'. If the match is
found, I have to append the value of the item in my ORIGINAL KEY that I
will pass to Varnish.

Once I have the key, I need to pass it to Varnish to get the complete
string attached to that key.

My Questions are:
1. What is the best way to do this. I can code this in C but I have no
experience with nginx code and I dont want to mess in it. Is there a way I
can write this in an external file and link it via conf?
2. I think this all is possible in lua and I can use the agentzh's lua
module but I am not familiar with lua language. Do you think this will be
efficient and my learning Lua is worth it?
3. Do you think the way I am doing it make sense or shall I adapt another
algorithm? The reason I need to use regex to clean and match is because I
will get millions of dynamic URLs and I cant use them as keys directly for
any cache. I got to process it before looking in cache. PHP / LAMP server
wont be fast enough to do all this for thousands of queries per second and
hence I want to stick with low level languages

Will be happy to share more details to get some directions.

Thanks
Sparsh Gupta
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Add C code in configuration?

Sparsh Gupta May 10, 2012 03:20PM

Re: Add C code in configuration?

Brian Akins May 13, 2012 10:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 125
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready