⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 performance-scrapbook.xtp

📁 RESIN 3.2 最新源码
💻 XTP
字号:
<document><header><product>resin</product><title>Performance Scrapbook</title><version>Resin 3.0</version><description><p>A repository of notes and comments that willeventually make their way into the documentation.  Pleasetreat the information here with caution, it has often not beenverified.</p></description></header><body><localtoc/><s1 title="General"><s2 title="What are the best things to tune for better performance?" type="faq"><description></description><p>The main configuration item is the <a config-tag="dependency-check-interval"/> especiallyfor Windows.  For deployment, you should set it something high like 60sor larger.</p><p>You can also change the <a config-tag="cache-mapping"/> values, especially for stufflike *.gif files that don't change.  Higher values mean that thebrowsers won't need to go back to the server.</p><p>Other than that, most of the default configuration values are prettygood, so you normally won't need to touch them.</p><p>The most important performance tweak you can make is to set Expires orbetter Last-Modified and/or ETag values on your servlet/JSP output.  Ifthe servlet/JSP output only changes every 15 minutes, as for a newspage, then caching it can be a big performance win.</p><p>Of course, for stuff like shopping carts and stuff that's personalized,that won't help.  But for many sites, the most heavily hit pages can becached.</p></s2><s2 title="Is Apache faster than Resin Standalone?" type="faq"><description></description><p>For small files, Resin is about 10-20% faster.  For large files (1M), they're essentially identical.  (It's possible that the very latest Apache has improved performance.)</p><p>For JSP and Servlets, Resin standalone is certainly faster than Resin/Apache.  Because of the extra overhead of the Resin/Apache connection, the Resin/Apache configuration is necessarily slower than Resin standalone.</p><p>It's only static files where Apache could be faster.  Well, there's an exception for SSL.  It's conceivable that Apache/Resin with SSL would be faster that Resin with SSL.</p></s2><s2 title="What is the performance loss with a Servlet or JSP comparted to a static file?" type="faq"><description></description><p>With Resin standalone, JSP files are essentially as fast asstatic files (as long as you don't actually do anyprocessing. :-)</p><p>If Resin is behind another web server, like IIS or Apache,there is a performance decrease with JSP and Servlet files,which comes from the overhead needed for the communicationbetween the other web server and Resin.</p></s2></s1><s1 title="Caching"><s2 title="What gets cached when a servlet does a forward?" type="faq"><description>I'm a bit unclear as to how to ensure that a servlet that forward to a JSPpage caches its output. Of course at the top of my JSP page (and any of its&lt;jsp:include&gt;s) I put &lt;%@ page session=false %&gt;. Now, what do I need to doabout cache-mapping? Do I need to explicitly map the servlet, or willresin.xml's suggested &lt;cache-mapping url-pattern='/' expires='15m'/&gt; work?</description><p>The only thing that matters is the HTTP headers.  So if you telnet to the server, you should be able to see whether the headers are properly set or not.</p><p>In the case of a forward, you should be able to just set the headers without needing to modify the JSP itself.</p>        <p>One thing to be aware of: the caching is based on the original URL.  So if your forwarding servlet varies it's output based on some request headers (like User-Agent), it needs to set the Vary header.</p><p>&lt;cache-mapping&gt; is a related but somewhat separate issue, and I think we haven't explained it properly. </p><p>&lt;cache-mapping&gt; only works on cacheable responses which have not set the Expires header.  If you're missing the Expires header, &lt;cache-mapping&gt; will set it for you.  </p><p>Cacheable means:</p><ol><li>either ETag or Last-Modified must be set in the response (ETag is better).  The servlet will normally set that value.</li><li>no cache-control is set in the response headers</li><li>no Vary tag is set (Resin doesn't completely implement Vary.)</li></ol><p>So your servlet still needs to do some work.  &lt;cache-mapping&gt; isn't all that you need.  The reason that &lt;cache-mapping&gt; works with  normal files is that Resin's FileServlet sets the Last-Modified and ETag headers, but does not set the Expires header.</p></s2><s2 title="What if while the cache is being filled, another request comes?" type="faq"><description>I've tried several other server-side caching mechanisms, andI've found that all of them are somewhat deficient when it comesto refreshing expired caches.  The problem that usually arises isthat when the cache expires, every request then tries to takeresponsibility for refreshing that cache - until one of themfinally completes and subsequent requests see the cache is up todate.  If the page takes a long time to finish execution on abusy site, this results in hundreds of requests piling up, allexecuting the original page to refresh the cache.</description><p>Resin 'fills a cache' the first time a request comes in.  Ifanother request comes in and Resin has not finished filling the cache,the second request will be treated as uncachable.  This means thatuntil the cache is filled, requests will miss the cache and getserviced directly.</p><p>This is also what happens when thecache expires.  The first request to come in after the expirytime invalidates it, and while it is being filled the otherrequests pass through to the resource being cached.</p><p>This behaviour may be changed in Resin 3.0, updates are available<a href="http://www.caucho.com/quercus/bugtrack/view.xtp?bugreport_id=1135">here</a>.</p></s2></s1></body></document>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -