Welcome! Log In Create A New Profile

Advanced

Re: Performance of map directive

September 03, 2011 11:52AM
On Sat, Sep 03, 2011 at 05:11:07PM +0300, Calin Don wrote:
> Hi,
>
> I understood that if you have only strings in a map directive the access
> time is O(1).

Yes.

> What if you have the hostnames directive enabled and some of the items are
> in the format *.example.com?

nginx tests address by its parts, first "com", then "example".
So access of the operation varies from O(1) to O(N) where N is number of
parts of longest name. For example, if you test example.net only against

*.example.com
*.sub.domain.com

then this will be O(1). If you test www.sub.domain.com, it will be O(3).

> What about if you mix with regular expressions?

The regular expressions tested sequentially.

nginx tests map in the following order:

1) exact names,
2) *.names,
3) names.*,
4) regexes.

The first match stops the tesing.


--
Igor Sysoev

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

Performance of map directive

Calin Don September 03, 2011 11:42AM

Re: Performance of map directive

Igor Sysoev September 03, 2011 11:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 156
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