simple_cahce nitrogen template timeout

13 zobrazení
Přeskočit na první nepřečtenou zprávu

ramkrishn...@gmail.com

nepřečteno,
29. 4. 2022 7:19:2429.04.22
komu: Nitrogen Project / The Nitrogen Web Framework for Erlang
Hi,

I'm seeing the following warning when requests on the server increase beyond a certain point. After this warning, page fails to load and server becomes unresponsive. Please let me know what this could be? Any performance fine tuning I can do to resolve this issue?

29T11:43:29.879597+05:30 warning: SimpleCache: Mutex "{nitrogen,{template_last_modified,'template_file_lib/itx/priv/static/adminkit/html/entered.html'}}" timed out after 10 seconds. Something might be wrong. Trying again.2022-04-29T11:43:33.482+05:302022-04-29T11:43:33.481615+05:30 warning: SimpleCache: Mutex "{nitrogen,

Thank you.

Jesse Gumm

nepřečteno,
29. 4. 2022 8:43:2629.04.22
komu: nitrogenweb
Hey Ram!

Try upgrading to the latest simple_cache (which uses nitro_cache behind the scenes).

The latest simple_cache should just download nitro_cache as a dependency and just ends up being pass-through calls to it.

If that doesn't fix it, let me know, and we can do more experimentation.

-Jesse

--
You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nitrogenweb...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nitrogenweb/bfa444a7-d1e7-4224-82b6-1e53ea10bd7bn%40googlegroups.com.


--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

Jesse Gumm

nepřečteno,
29. 4. 2022 8:57:5829.04.22
komu: nitrogenweb
Oh, relevant link to nitro_cache


-Jesse

ramkrishn...@gmail.com

nepřečteno,
29. 4. 2022 9:04:0129.04.22
komu: Nitrogen Project / The Nitrogen Web Framework for Erlang
Thanks Jesse for the quick response. 

I've increased the cache timeout for template modified check to 24 hours as follows:
 LastModified = wf:cache({template_last_modified, FileAtom}, 1000*60*60*24, GetLastModified),

Do you think this is going to help? Or is moving to nitro_cache is going to be a better solution?
I've used simple_cache for my application at other places in my app.

Is nitro_cache a better implementation of simple_cache?

Thanks.

Jesse Gumm

nepřečteno,
29. 4. 2022 9:15:0429.04.22
komu: nitrogenweb
Hey Ram,

nitro_cache is really just a renamed version of simple_cache (naming conflict with an elixir project in hex.pm).

However, if you upgrade to the newest simple_cache, it'll pull nitro_cache and implement an alias so that all simple_cache calls go to nitro_cache as expected.

There *are* improvements, though.  There is an issue in earlier versions of simple_cache where if the lookup function crashes for some reason, simple_cache didn't properly release the mutex leading to that specific timeout error.

The function in question that is getting hung in your app (the last modified time of the template), is just using nitro_cache for a performance boost (instead of hitting the hard drive for every #template{} rendering - on my local machine, it amounts to about 400% speedup).

-Jesse


ramkrishn...@gmail.com

nepřečteno,
29. 4. 2022 9:21:4929.04.22
komu: Nitrogen Project / The Nitrogen Web Framework for Erlang
Thanks a lot of the explanation. I'll try moving to the latest simple_cache and get nitro_cache benefits.

Thanks again!

ramkrishn...@gmail.com

nepřečteno,
29. 4. 2022 12:47:1829.04.22
komu: Nitrogen Project / The Nitrogen Web Framework for Erlang
Hi Jesse,

What's the limit for number of keys that can be stored in the cache? At what point can I expect lookup performance to start degrading? 

Jesse Gumm

nepřečteno,
29. 4. 2022 13:06:3329.04.22
komu: nitrogenweb
Hey Ram,

Honestly, I'm not sure.  Each nitro_cache/simple_cache bucket is just an ETS table, and as far as I know, ETS tables are just limited by memory on the machine.

-Jesse

ramkrishn...@gmail.com

nepřečteno,
29. 4. 2022 13:13:4129.04.22
komu: Nitrogen Project / The Nitrogen Web Framework for Erlang
Thank you Jesse!
Odpovědět všem
Odpověď autorovi
Přeposlat
0 nových zpráv