Last night I finally kicked JRun to the curb and replaced it with Tomcat on my personal server. I knew JRun was a pig and that I'd get some improvements by switching, I'd just never gotten around to doing it. I don't know why I waited. Here are two graphs from my server, see if you can figure out when the switch happened:
Migration was mind-numbingly simple:
- download and unzip Tomcat 6.0.24
- change server.xml so the HTTP connector listens on 8082
- copy everything from the JRun webroot to the Tomcat webroot
- update Apache's config to proxy to Tomcat's port number (8082) instead of JRun's (8300)
- start Tomcat, stop JRun, restart Apache
Since I'm running CF8, nothing else is required. If I were running CF9, I'd need JTA (from http://java.sun.com/javaee/technologies/jta/index.jsp) so Hibernate would work, since Tomcat doesn't bundle it (it's a web container, not an app server).
If you looked carefully at the graphs you'll have noticed two "Tomcat" series, rather than one. I neglected to increase the MaxPermSize when I first set it up, so the "swap" at about 8:45am was making that change. The "LCYSA" process is another Tomcat running a pair of Magnolia instances (in different contexts), "Apache" is Apache HTTPD, and "MySQL" is the MySQL 5.0 server I store everything in for all apps.
The charts are generated by a simple CF app that parses `ps v -A O-v` output into a database, and then builds Google Charts from the data. You can view the app, or check out the source. It's not elegant, refined, maintainable, or really even very functional, and I had no intention of sharing until magnus asked in the comments. But I also prefer transparency, so there it is. A crontab runs `capture_mem_state.sh` every 10 minutes, and then the CFML reads in the files it generates. Play online games on the friv games site with the whole family. Only the best online games are presented on this mega portal.
What's the CF app? Is is available to share?
Neat. The charting is a good idea and really cool.
@magnus,
I added links to both the app and the source in the post, so you can see it in action as well as check out how it's implemented. I make no claims that the implementation is anything even approaching ideal. I threw it together for my personal use in the span of an hour or two, and made no attempts to make it "good".
We recently had a problem with running out of memory on our hosted VPS. Because it was a shared server the ISP restricted virtual memory. When RAM was used up we hit a wall. So being able to easily see what is going on is quite useful. Thanks.
Ps. any chance of a dump of the database schema. Sorry to ask so much.
The current schema is available here:
http://www.barneyb.com/barneyblog/wp-content/uploads/2010/02/mem_state_schema.sql
Like the app it's for MySQL 5.0 with InnoDB, but it'd be easy to adapt.
Hi barney, would the swap be as easy when running multi-instances of CF8 on Jrun4 on IIS7 in Windows 2003 with MSSQL2005? 'Cause then it would be a viable option for us to get the mem-consumption etc down on ou servers.
hi barney, is your server running in J2EE mode?
@Sebastian
We used to run IIS in front of our Tomcat-contained CF8 instances at work, but we've switched to Apache. The only thing changing is the container (JRun to Tomcat), so aside from the web server connector (if you use one), the rest of your stack is totally isolated.
Obviously you'd need to test and see if you get the same memory improvements I saw. Windows and Linux manage their memory in different ways, so you might see different results.
@Ed
Yeah, this only works with the JEE mode. With standalone mode you can't separate CF from JRun itself.
Barney – what about performance beyond memory consumption? How does your app run? My understanding is that one of Railo's big speedups is that it's simply not on JRun. Are you getting a lot of the same boost by just switching out the container?
Brian,
Yeah, it definitely feels snappier, though I don't have any way to quantify it. I could look at request times, but most of my CFML is under very low load, so a non-trivial amount of processing was paging both JVM and MySQL into RAM. So kind of a wash.
With regards to Railo, it's noticeably faster than CF, even with both of them running within Tomcat. We run a CF/Magnolia/Tomcat stack for everything at work (no JRun anywhere), and the apps are appreciably faster with a Railo/Magnolia/Tomcat stack. But we have hundreds of thousands of lines of CFML, so migrating is not a quick process. We haven't build a new CFML app on CF in quite a while though; it's all Railo.
Hi Barney,
I'll have to agree on Railo there – develoing all new apps in Railo, but always building them so they are immune to app-engine specific oddities. It means writing as standard CFML as possible, and if needed build in switches for the different app-engines (f.ex. CF8+: CFIMAGE vs. Railo 3+: imageCFC).
Most of my development work I do on the standalone install with Railo + Jetty on WinXP/Apache/MySQL. Serverwise we're divided between CF8+/MySQL/Windows2003/IIS6 and Railo3+/Tomcat/Apache/Linux – but the Railo engine is so much faster and easier to set up. The two different administrators are a thing of beauty. It takes some time to get used to some Railo quirks in the administrator, and not all you can do in CF-Admin you can as easily or at all do in Railo-Admin. But I believe it's getting there towards v9 compatibility (the next Railo dognamed-version).
Hi all.
In our company we have been running an application on IIS5.0 and JRUN 4.0 for about 6 years already. The app database is SQL 2005. Now we are in the need of upgrading to IIS 6.0 or IIS 7.0. We have been chasing a solution to implement JRUN 4.0 with those versions of IIS and it has been a complete nightmare for months.
We would like to find an easy way to get rid of JRUN 4.0 and upgrade our IIS server. Do you happen to know if IIS 6.0 or IIS 7.0 works fine with TomCat? Is there an easy way to do the migration smoothly without having to change code? We understand our code is not dependant on JRUN.
Thank you.
Bart,
IIS 6/7 works with Tomcat just fine; that's how we used to host our CF before we switched to Apache (on Windows) and now to Linux. I'm not an IIS guy so this is really generic, but you set up a filter to Tomcat in much the same way you currently have a filter set up to JRun. Tomcat comes with stuff to make Windows services out of your daemons as well.
JRun provides some hard-core virtualization of the webroot that Tomcat does (and is much better done with the web server anyway), so if you're using that you'll probably need to reorganize your webroot a bit. But that shouldn't be too much work, and won't affect your code itself (unless you have hard coded paths in there or something).
@Bart,
We've run JRun4 on IIS6 on top of Windows2003 with CF8 now for more than a year with absolutely no hiccups. JRun even is multiinstance, and we have a MSSQL 2005 db-engine. All the sites and the webapps are high-volume, so I don't know what's been bothering you!
Maybe went your problems here?
Sebastiaan
Barney – thanks for the feedback! Switching to Railo is something we're evaluating but we do use quite a few of the Adobe features like cfchart, cfdocument, etc. I know there are alternatives but we need to figure out the amount of time to switch. We're a Model-Glue/Transfer/Coldspring app… Sean commented there may be some things Transfer does that rely on Adobe-specific behavior so we're looking. May test Tomcat on CF8/9 to see what kind of an instant bump we could get with no code change (just $$$).
Barney,
I want to migrate my batch jobs (java) to Tomcat from JRun. Any idea this can be done without or minimal code change?
sundar,
If they're just plain ol' Java, you shouldn't have to change anything. If they rely on executing in a JEE App Server you'll be stuck, because Tomcat is only a JEE Web Container, but that (and reliance on internal JRun APIs) should be the only stumbling blocks to moving from one container to the other.
before the switch – did you ever try to tweak jvm on JRun? Jrun out of the box is a pig, but once tweaked it works just fine – and you loose clustering with tomcat….
Jack,
Yeah, I did some tweaking, but couldn't get down even close to what Tomcat runs totally stock. As for clustering, I'm not sure what you mean? We run a whole pile of clustered apps on Tomcat at work without any issues… Perhaps JRun enabled some CF-specific clustering stuff, and that's what you're referring to?
Hi Barney,
Would ya please do me a favor by creating a ODBC Socket Data Source to see if it works? I have installed CF9 on Tomcat 7 build 22. Everythjing seems ok , exception when I tried to add a Datasource name for ODBC Socket, it complained that ODBC is not installed.
I did reinstalled CF9 many times and whenever I tried to create an ODBC DSN with ODBC Socket , I will get an error of 'ODBC is not installed.
When Installing/updating CF9, I have selected all subcomponnents to make sure it installed ODBC Socket.
Please help to see iif it works on your.
Thanks, BN.