Reputation: 52770
I am currently migrating a large website with a lot of static content (HTML files) and a bit of dynamic content.
I'm trying to create the most performant website I can by trying to make everything as static as possible and using as few servlets as I possibly can. However, since the old website supported complex URL's I will need some rewriting and would need some of it to be dynamic e.g.: http://oldsite/url.html and http://oldsite/url would both work for the same URL...
I'm looking for performance facts e.g. with benchmark results to back this up on the impact of a statically served site.
Initially I thought I'd create a filter but that would create an overhead on every request going into the site. I thought about just using something like overriding the 404 mentioned here and then the overhead would be relatively low (for old bookmarks/caches).
There is also the rewrite option but that's both lock-in and I'm not really sure how to use it to map blank URL's to HTML files... Currently I'm guessing its the most performant way though.
Upvotes: 0
Views: 530
Reputation: 471
If the rewritings/redirections are straight forward (no regular expressions required), you could use a static concurrent Radix Tree and initialize it with all the rewritings/redirections you want to apply. In worst case, a URL that is supposed not to be renamed won't be recognized by the Radix Tree and as it is concurrent and fast, it shouldn't create a huge burden.
If you need regexp-like rewritings and you don't want to only depend on Apache Tomcat, you can also try UrlRewriteFilter which should work for all the Servlet-compliant application servers. Even though it might seem it's quite a slow solution they claim it's actually pretty fast.
Upvotes: 1