Why are JSPs so slow? (Tomcat 7 vs. Apache)
It would be unreasonable to expect JSPs to be served at the same rate as static files. Even after being compiled, requests to JSPs must pass through layers of servlet container code, not to mention the latency of the JSP code itself. However, the difference between static files vs. JSP is much larger than I would have expected.
I ran a test on a 6KB HTML file using Apache Benchmark on my Dell Inspiron N7010 laptop, using 1,000 requests @ 10 concurrent requests. I also created a JSP by pasting the same HTML into a file, adding only a few dynamic elements: outputting the of the host name, port, and app URI. No calls to any beans, JDBC, or other potentially slow resources were made. Default installations were used for both Apache and Tomcat 7. The results were stark:
- Apache static HTML file: 971.25 pages/second (blazin’)
- Tomcat 7 JSP file: 92.5 pages/second
As you can see, the JSP is not merely slower. It is a full order of magnitude slower. Because the dynamic content is trivial in this test file, the performance of the servlet container fully accounts for this difference.
I thought I’d also test loading the JSP through Apache using mod_jk to see what kind of performance penalty this imparts. Results:
- Tomcat 7 JSP file via Apache mod_jk: 74.80 pages/second
So in this test case, there was a 19% performance penalty fronting Tomcat with Apache. Of course speed is not the only consideration when evaluating using this type of setup, but it is something to weigh against other concerns.
There is also a debate about whether Tomcat or Apache is faster at serving static files. This test is only one data point, but Apache easily wins here. Tomcat serving the static 6KB file:
- Tomcat 7 static HTML file: 203.5 pages/second
In this test, Apache was nearly five times faster at serving this file (though more than twice as fast compared to the JSP version).
And now, for people who like charts. =)
Spam in WordPress Comments
This blog is only a few weeks old, and I’ve managed to attract 12 comment spam attempts. 86% of the comments so far have been spam. When I was initially configuring WordPress I selected moderated comments, so I’ve had to review each one manually. Most spams are of the variety that attempt to fool the blog owner into thinking it’s a real comment. “That was interesting. I’ll have to think about it a little more.” I suppose these are all automated.
I’ve briefly looked into spam filter plugins. I was about to enable Akismet when I learned it is a pay service. I can’t justify paying for spam filtering on a new blog with few comments. If anyone has any plugin recommendations, please share in the comments. I promise to approve all legitimate responses!
UPDATE: I’m up to 92% spam comments now. I guess the bots are starting to discover this blog.
Best stats plugin for WordPress: ShortStat
This is just my opinion, based on what I was looking for, which is: a very simple WordPress blog plugin for gathering and reporting stats like unique and total hits, referrers, and search keywords. I wasn’t interested in a heavy-weight stats program. I already use Google Analytics, but for this blog I wanted a plugin to put exactly the stats I’m interested in on my WordPress dashboard.
ShortStat does exactly what I want. It’s a simple and (as of this writing) actively-maintained WordPress stats plugin that provides a quick dashboard link, putting your stats a mere click away. Read more
Groupon says what?
I can’t be the only one who finds “Groupon Says” completely pointless. The sayings certainly aren’t “hyper-factual”, and neither are they humorous. It just seems bizarre that a big-name company like Groupon would put this sort of thing on all their pages. And, why a cat? I guess the feature is supposed to add a quirky idiosyncrasy to the site, to make it more endearing and less corporate. But it comes across like an idiosyncrasy as designed by committee. I can just imagine how it went: “I have an idea! Let’s add a picture of a cat! Internet denizens seem to love pictures of cats.” “Brilliant!”
Using word clouds for SEO keyword analysis
Wordle is an online tool that creates “word clouds” out of text. Basically, you feed it some text and it generates an image of jumbled up words, with the size of each word determined by how frequently it is repeated. One way to think about it is, Wordle gives you a rough idea of how a search engine spider sees your page. This may be helpful in your SEO efforts.
For example, here is a word cloud of my blog post on geolocation. (click for larger size)
Instantly, the main theme of the post jumps out, with words such as “geolocation”, “city”, “code” and “GeoIP” featuring prominently. Then you also see secondary words, such as “region”, “PHP”, and “database”, adding additional context. In SEO terms, the larger words are your keywords. The font size represents your keyword density.
Another word cloud after the jump: Read more
Censorship on Facebook – Others can’t see your posts
Facebook seems to be employing a troubling, sneaky sort of censorship algorithm that is applied when people post to the pages of organizations, politicians, etc. It appears to be a form of the “Tachy goes to Coventry” ignore function seen on vBulletin, by which I mean: your posts are visible to you, and all appears perfectly normal; however, nobody else sees your posts. What makes this troubling is that it appears to happen via algorithm rather than human intervention, and there is no notification to the user that his or her posts are invisible to others. In fact, like the vBulletin functionality, it seems intentionally designed to mislead the user into believing his or her posts are appearing normally.
Glossy Screens on Laptops Suck
I understand why glossy screens have completely overtaken matte screens; glossies look a lot sexier on display at the store. Images and videos are shown in vivid, eye-catching color and contrast that matte screens cannot achieve. However, the flaw of the glossy screen is easily overlooked at the store display.
I purchased a glossy screen model several years ago, when they were just becoming popular. It was not long before I noticed how much glare these screens pick up. They reflect light like a mirrored surface! In certain light conditions glossy screens are completely unusable, where a matte screen would be acceptable. I found myself often adjusting the screen, tilting it, turning it, to minimize the glare. It became a constant annoyance.
Now I’ve gone laptop shopping once again, and my local Best Buy no longer carries a single matte screen model. Glossies have completely overtaken. Where is the consumer choice? I realize that the colors on matte screens don’t “pop” like they do on glossies, but that’s a sacrifice I’d make to be rid of the annoying glare problem.
The few matte screen laptops I’ve found for sale online tend to be Thinkpads and other business-focused models. If I were to limit myself to matte screens only, my selection would be pretty thin. I guess I’ll likely suck it up and reluctantly go with a glossy.
UPDATE: what a sad, yet prescient comment (from 2006!) I came across on this topic:
The glare is terrible and you can’t use the laptop outside at all. The side viewing angle is totally destroyed because looking at the screen from the side looks just like a mirror.
What in the world were they thinking? I sure hope that this does not become a major trend.


