Search code examples
nginxssi

How does nginx ssi work?


Cant find any info about it.. so I have few question

I need to use it to help solve the "big problem" of cache invalidation

1)if I understand right it need to search in every file it served to find if it need to include other files sound like very unperfomance?

2)does it fetch them one after another or all in the same time?

3)does it mean that if I have 3 esi in 1 file than my nginx will recive 3 more request for every request to this file?

4)is it in use in 2015?

cant find any info about it except the minimal nginx docs which dosent give any technical info thanks


Solution

  • Based on the documentation of ngx_http_ssi_module, it causes all responses going through to be scanned for SSI commands.

    So it has nothing to do with files or anything. It doesn't matter from where the content is generated (plain file, reverse proxy, fastcgi/php), this module will analyze the generated content.

    1. I don't think SSI will bring you major performance penalty (unless you are serving and analyzing big binary files). You can limit which content is scanned for SSI by MIME type (by default only text/html). If you need exact figures, you need to do performance tests with and without SSI.

    2. If we are talking about including other files from your SSI commands, then by default all of them are fetched in parallel, so from time perspective it doesn't matter if you include 1 or 3 files. Of course with 3 files your server has more work to do.

    3. Yes, having included more files/urls means more requests for nginx (unless those urls point to some other server).

    4. The SSI module is still present in latest nginx release, but I don't know if any big company actually uses it. It all depends on what you want to achieve. I have still not understood how you want to do cache invalidation with SSI.