Pregunta

Realmente me gusta Nginx.

Pero recientemente descubrí que Varnish le brinda la oportunidad de implementar la capa de proxy de inversiones de almacenamiento en caché inteligente (con purga de URL). Tengo un clúster de mestizos que son bastante intensivos en recursos, por lo que si esta capa de almacenamiento en caché puede eliminar algo de carga de los mestizos, esto puede ser una gran cosa.

No encontré una manera de implementar la capa de almacenamiento en caché (con páginas de aplicación; el contenido estático es almacenable, por supuesto) igual con Nginx.

¿Debería usar barniz en su lugar? ¿Qué recomendarías?

¿Fue útil?

Solución

I do not know what you mean under "smart", but anyway Nginx has caching starting from 0.7 branch. There are many parameters to tune, e.g.

  • you can have various TTLs for different return codes,
  • ability to return stale content when application does not respond
  • possible to limit the total size of the cache on disk
  • you can define what pieces of information will be used to generate a cache key.

The documentation is here

Otros consejos

Nginx has some nice features if you just need very basic caching, but Varnish lets you do active purges by URL or header matching, edge side includes so different parts of your pages can have different TTLs, and lots of other trickery because it has a very flexible configuration language.

If you really want to seriously cache and reduce load on your backends, I'd go with varnish, but it's going to be a lot more work to set up than just adding a few directives to your nginx.conf.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top