On Tue, 9 Oct 2018 at 11:23, Alex 'CAVE' Cernat <[email protected]> wrote:
> Salut > > Ca de obicei o intrebare de baraj. Incerc sa inteleg exact cum > functioneaza fastcgi cache-ul la nginx, insa toata lumea da doar exemple > de configuratii, insa pe nicaieri nu am gasit informatii de inside. > > Concret, ma intereseaza cand sau unde se face lookup-ul in cache. > Both the key and file name in a cache are a result of applying the MD5 function to the proxied URL. Deci lookup se face cind esti pe location-ul respectiv si URL-ul e disponibil Din surse https://github.com/nginx/nginx/blob/master/src/http/modules/ngx_http_fastcgi_module.c se pare totusi ca face hash pe url si pe header. Nu e o idee buna sa pui un cache zone comun din alt motiv: A minute after the start the special “cache loader” process is activated. It loads information about previously cached data stored on file system into a cache zone. The loading is also done in iterations. During one iteration no more than loader_files items are loaded (by default, 100). Besides, the duration of one iteration is limited by the loader_threshold parameter (by default, 200 milliseconds). Between iterations, a pause configured by the loader_sleep parameter (by default, 50 milliseconds) is made. pentru fiecare cache nginx tine in memorie keys In addition, all active keys and information about data are stored in a shared memory zone, whose name and size are configured by the keys_zone parameter. One megabyte zone can store about 8 thousand keys. Daca ai 100 vhosts fiecare cu cache-ul lui si sa zicem fiecare cu 8000 keys ai 100mb de memorie folosita Daca ai 100 vhosts la comun, o sa ai 100x8000 obiecte care o sa manince 100mb per fiecare vhost, pentru ca loaderul o sa incarce in key area tot ce gaseste in cache. Poate inteleg eu ceva gresit, dar dupa manual asta inteleg eu. > Presupunerea mea ar fi ca ar trebui sa-l faca numai cand requestul > ajunge in location-ul unde este definit acel cache. (bine, configuratia > de nginx fiind declarativa si nu imperativa, trebuie mare atentie la > cuvinte, dar traducem pe alocuri :-P). Poate cineva sa-mi confirme cu > ceva documentatie ? > > Asta ar insemna ca la nevoie multiple locatii ar putea folosi acelasi > cache, ba chiar si mai multe vhosturi ar putea sa-l share-uiasca, atata > timp cat vorbim de acelasi cache, iar cache key-ul este definit cu mare > atentie. > > Si repet, o diagrama cu modul de functionare si timing al fastcgi > cache-ului ar fi de mare ajutor, dar n-am gasit nimic de genul asta > > > Mersi, > Alex > > _______________________________________________ > RLUG mailing list > [email protected] > http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro > _______________________________________________ RLUG mailing list [email protected] http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro
