silken icon indicating copy to clipboard operation
silken copied to clipboard

Performance question

Open marceloverdijk opened this issue 11 years ago • 4 comments

I don't know if this the right channel to ask this question, but as I could not find a dedicated forum I will do it anyway :-)

As I can read on the github page Silken is used in production. I wonder if you did any benchmarking with the servlet container startup times? The reason I'm asking is because the templates are compiled during startup, and there will be differences in compiling 1 templates or > 1000. Especially if you are running on Google App Engine startup times are an important aspect as Google spawn and kills instances frequently.

Regards, Marcel

marceloverdijk avatar Apr 15 '13 06:04 marceloverdijk

Hi Marcel,

A fair question and this is as good a place as any to answer/answer. We (PaperCut) use Silken in production on Google App Engine. The startup time on an F1 instance (with a few other dependencies such as HtmlEasy) is around 9 seconds. A good way to get a feel is to play around with the ready-made GAE product for HtmlEasy (which includes Silken).

https://code.google.com/p/htmleasy/wiki/UsingHtmleasy

Adding extra templates will add startup/compile overhead, however most of the time is in the general servlet init. Once initialised compiling extra templates happens very quickly. I haven't done any benchmarks on 1000+ templates though.

I should also point out that you can configure Silken to compile the templates on startup (e.g. in a loading request), or on-demand (when the template is first requested). With some logical namespace separation you can also structure it so your popular templates are rendered on startup (e.g. warmup request), while the less popular ones are rendered on demand.

Hope this helps. Let me know your experiences.

Cheers,

Chris

codedance avatar Apr 15 '13 12:04 codedance

Hi Chris,

Thanks for reply. Would you be able to give some insight how many files/templates you compile at startup? This would be interesting to know.

I'm evaluating using Closure Templates in a Spring environment as alternative to JSP's. Many concepts you used in Silken will probably be of interest for Spring/Closure Templates integration as well.

PS: 9s startup times are very nice. Using Spring gives me > 20s. An additional 10s for e.g. Closure Templates would not be a problem then...

marceloverdijk avatar Apr 16 '13 12:04 marceloverdijk

You need to be careful with startup times on GAE, even if you're using warmup requests. A percentage of requests may hit unwarmed up instances. I've personally found Spring a little heavyweight for GAE. Internally we've used lighter weight solutions such as Guice and HtmlEasy/RestEasy.

I don't have any timing on template compile times. It's sparked my interest. I'll leave this tick open and when I get a spare moment I'll create a bunch of representative templates and see what timing we get.

codedance avatar Apr 18 '13 02:04 codedance

Hi @codedance, Yes I know I have to be careful with startup times on GAE. I did some tests in the past and even using resteasy (and guice) gave me startup times +10s. If I remember correctly between 12s and 15s. Honestly for me there is no difference in startup time of 12s (e.g. resteasy) and Spring (30s). In both cases it's unacceptable :-) But using plain servlets is also not really an option in terms of productivity.

marceloverdijk avatar Apr 18 '13 06:04 marceloverdijk