Welcome! Log In Create A New Profile

Advanced

map v/s rewrite performance

March 25, 2014 04:12AM
Hi All,

I am just wondering, say for 1000 url redirects, what will be more efficient.

Rewrite Style:
============
server {
rewrite old-url-1 new-url-1 permanent;
rewrite old-url-2 new-url-2 permanent;
rewrite old-url-3 new-url-3 permanent;
#....
rewrite $old-url-1000 $new-url-1000 permanent;
}


Map Style:
============

map $request_uri $new_uri {
default $request_uri;
old-url-1 new-url-1;
old-url-2 new-url-2;
old-url-3 new-url-3;
#....
old-url-1000 new-url-1000;
}

#and something like
server {
try_files $new_uri =404;
}

Since nginx is very fast, I am not able to notice any delay for around 20 rewrites. :|

Is one of above 2 method is recommended for large number of rewrites?

I am inclined towards map, as rewrite adds plenty of notices logs. It's like every rewrite is checked for incoming requests unless it is surrounded by location.

Please let me know if more details are needed.

Thanks.

--
Rahul Bansal
EasyEngine - https://github.com/rtCamp/easyengine
Subject Author Posted

map v/s rewrite performance

rahul286 March 25, 2014 04:12AM

Re: map v/s rewrite performance

Igor Sysoev March 25, 2014 04:18AM

Re: map v/s rewrite performance

rahul286 March 25, 2014 04:43AM

Re: map v/s rewrite performance

rahul286 April 04, 2014 08:05AM

Re: map v/s rewrite performance

Igor Sysoev April 06, 2014 04:04AM

Re: map v/s rewrite performance

rahul286 April 06, 2014 09:49AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 119
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready