Mapping url to physical urls using lua script or something else.

Hemant Bist hemantbist at gmail.com
Mon Mar 25 16:39:15 UTC 2019


Thanks peter,
In this case, both the new set of urls and old set of url are going to be
exposed to different set of users. (And there are some DRM  related details
I omitted in the email)
(similar to what  you are suggesting ) : One of the changes I am testing is
simply copying the files/linking the files( which means serving tiles via
nginx would be trivial , at the cost of increasing memory /  complications
in the backend scripts that sync the data).

1) Computationally the mapping is not that hard, and the production server
is has lot of CPU. So I am hoping that we can get away  with some sort of
simple lua script.

2) Additionally it looks like a small percentage of the urls(both number
and traffic wise) are served by lookup on a small redis db, and lua. So no
major changes would be required in installation etc : as long as it scales
decently...
HB
HB



On Sat, Mar 23, 2019 at 7:39 PM Peter Booth via nginx <nginx at nginx.org>
wrote:

> Here’s my opinion:
>
> You can do this however you want. It’s your website. Most of my work has
> been for other people. When I was working on my own startup it made me
> honest. Nothing was dynamic. The rationale  was “do everything ahead of
> time so users never wait for anything and the site has 100% uptime”.
>
> So for your usecase - why make your users pay the price of your hashmap
> lookup? Why not publish/rewrite your content to the “right” site structure
> ahead of time? Sure, nginx with openresty / lua can be a super fast
> appserver. But boring solutions beat clever every time.
>
> My two cents,
>
> Peter
>
> Sent from my iPhone
>
> > On Mar 23, 2019, at 8:17 PM, Hemant Bist <hemantbist at gmail.com> wrote:
> >
> > Hi,
> > I want to know if this a right way to make the change ( or if there is a
> better /recommended method). So far we have only tweaked the configuration
> of nginx which scales very nicely for us  The change I need to do looks
> like a common case to me.
> >
> > Currently our urls map directly to the local dir structure
> > e.g. the url /foo/10000/1234/9999/my.jpg is local file
> /var/www/html/foo/10000/1234/9999/my.jpg so
> >
> > Now the url /foo/first/second/third/my.jpg will map to
> /newfoo/new_first/new_second/new_third/my.jpg
> > where newfoo folder is done by lookup of a  static Hash_map/table of
> about 10000 to 20000 entries.
> > new_first (new_second and new_third) are calculated by some arithmatic
> operation on first(second and new  third).
> >
> > My plan is: a) pass all handling to a lua script that will do
> internal_redirect to the correct physical url... And do a load test to make
> sure that is not too much performance hit.  [ I haven't implemented it, but
> it looks possible from the examples I have looked at so far]
> >
> > Best,
> > HB
> >
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20190325/f4146dd0/attachment.html>


More information about the nginx mailing list