log4p

Peter Maas’s Weblog

Archive for June, 2007

Electronic music and vintage computers

I came across the following video on the Computer Music website:

Although they claim that we have come a long way, I’m not so sure… The demonstrated C64 software looks like it is really fun to use!

No comments

Larger application (spring/hibernate/ehcache) running on Terracotta

With some tweaking I managed to get one of the webapps in our current project to run using terracotta to cluster caches. The only modification I had to make was related to one of my objects not being threadsafe; actually I solved a potential concurrency problem.

Configuring Terracotta proved to be a bit more complex then I anticipated; but this might be due to my lack of Terracotta knowledge.

Here is the tc-config file I created:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <tc:tc-config xmlns:tc="http://www.terracotta.org/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3.   xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-3.xsd">
  4.   <servers>
  5.     <server host="%i" name="sample" />
  6.   </servers>
  7.   <clients>
  8.     <logs>/Users/peter/JavaApplications/sandbox/log/%D</logs>
  9.     <modules>
  10.       <module name="clustered-commons-collections-3.1" version="1.0.0" />
  11.       <module name="clustered-ehcache-1.3" version="1.0.0" />
  12.       <module name="clustered-hibernate-3.1.2" version="1.0.0" />
  13.       <module name="autolock-synchronizedcollection" version="1.0.0" />
  14.       <module name="autolock-synchronizedset" version="1.0.0" />
  15.     </modules>
  16.   </clients>
  17.   <application>
  18.     <spring>
  19.       <jee-application name="*">
  20.         <session-support>false</session-support>
  21.         <instrumented-classes>
  22.           <include>
  23.             <class-expression>nl.cinema..*</class-expression>
  24.           </include>
  25.           <include>
  26.             <class-expression>org.hibernate.collection..*</class-expression>
  27.           </include>
  28.           <include>
  29.             <class-expression>org.hibernate.cache..*</class-expression>
  30.           </include>
  31.           <include>
  32.             <class-expression>org.hibernate.type..*</class-expression>
  33.           </include>
  34.           <include>
  35.             <class-expression>org.hibernate.EntityMode</class-expression>
  36.           </include>
  37.         </instrumented-classes>
  38.         <transient-fields>
  39.           <field-name>net.sf.ehcache.store.DiskStore.spoolThread</field-name>
  40.           <field-name>net.sf.ehcache.Cache.shutdownHook</field-name>
  41.           <field-name>net.sf.ehcache.store.LfuMemoryStore.random</field-name>
  42.         </transient-fields>
  43.         <locks>
  44.           <autolock>
  45.             <method-expression>* nl.cinema.domain.global.Describer.*(..)</method-expression>
  46.             <lock-level>write</lock-level>
  47.           </autolock>
  48.           <autolock>
  49.             <method-expression>* nl.cinema.domain.util.CacheGroup.*(..)</method-expression>
  50.             <lock-level>write</lock-level>
  51.           </autolock>
  52.         </locks>
  53.         <application-contexts>
  54.           <application-context>
  55.             <paths>
  56.               <path>/WEB-INF/applicationContext.xml</path>
  57.             </paths>
  58.             <beans>
  59.               <bean name="pageCache">
  60.                 <non-distributed-field>logger</non-distributed-field>
  61.                 <non-distributed-field>configLocation</non-distributed-field>
  62.               </bean>
  63.               <bean name="groupCache">
  64.                 <non-distributed-field>logger</non-distributed-field>
  65.                 <non-distributed-field>configLocation</non-distributed-field>
  66.               </bean>
  67.             </beans>
  68.           </application-context>
  69.         </application-contexts>
  70.       </jee-application>
  71.     </spring>
  72.   </application>
  73. </tc:tc-config>

I'm not sure if it would be possible to specify the non-distributed-field in a more global way; without resolving to XML entities.

No comments

First experiments with Terracotta

During the J-Spring conference yesterday I visited the session on Terracotta; I liked what I saw and started experimenting with it right away. Probably shouldn't have started with a complex application... had a lot of problems there.

I decided to step back a bit and set up two simple webapplications which put something in the session. Enabling terracotta requires a bit of JVM flag voodoo; I extended the VM arguments in Tomcats' launch configuration with the following:

  1. -Dcom.sun.management.jmxremote
  2. -Dcom.sun.management.jmxremote.port=8092 // [8091 for node1]
  3. -Dcom.sun.management.jmxremote.authenticate=false
  4. -Dcom.sun.management.jmxremote.ssl=false
  5. -Dtc.node-name=Node2 // [Node1 for node1]
  6. -Dtc.install-root=/Users/peter/downloads/terracotta-2.4-stable0/
  7. -Xbootclasspath/p:/Users/peter/downloads/terracotta-2.4-stable0/lib/dso-boot/dso-boot-hotspot_osx_150_07.jar
  8. -Dtc.config=/Users/peter/JavaApplications/sandbox/tc-config.xml

The referenced boot jar was generated using the make-boot-jar.sh script; it takes care of actually starting Terracotta when Tomcat starts. The config file (tc-config.xml) looks like this:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <tc:tc-config xmlns:tc="http://www.terracotta.org/config"
  3.                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4.               xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-3.xsd">
  5.   <servers>
  6.     <server host="%i" name="sample" />
  7.   </servers>
  8.  
  9.   <clients>
  10.     <logs>/Users/peter/JavaApplications/sandbox/log/%D</logs>
  11.   </clients>
  12.  
  13.   <application>
  14.     <spring>
  15.       <jee-application name="*">
  16.         <session-support>true</session-support>
  17.       </jee-application>
  18.     </spring>
  19.   </application>
  20. </tc:tc-config>

Before starting the Tomcat instances part of the cluster I started the Terracotta server, which administers the cluster by using the start-tc-server.sh script supplied in the Terracotta bundle.

Since everything is wired up for JMX we can now view all statistics en statuses using JConsole:

Two Tomcat servers and the Terracotta serverTwo connected nodes!Session statistics for one of the nodes.

So fare everything works as expected, session clustering works! Next steps will include EHCache, Hibernate, Lucene etc. I'll keep you posted!

No comments

VI and ITerm

Recently I installed iTerm and I must say that I'm very pleased with it's performance. However after the latest update my arrow keys stopped working when using VI.

Lucky me, the fix wasn't to hard, I added 'TERM=linux' to my /etc/bashrc file... et voila!

Comments are off for this post

JSpring 2007

Today I visited the JSpring conference organized by the Dutch Java Usergroup (NLJUG). I met lot's of people I hadn't seen for a while, amongst them the lead developer of gaphor nice to meet up again after almost 3 years.

Keynote
This year over a 1000 visitors are expected to attend the JSpring 2007 conference. The usergroup is profesionalizing; a fresh new look & feel! Short presentation of the new member registration system build by students from the Avans school; not to interesting.

Opening session

ATOS Origin - Olympic games
Talk on the IT side of large sports events by Willem van Breukelen. Yes it's a huge project, yes it has to be complex. No, without technical details I can't be bothered.

Open Terracotta: Open Source JVM-level Clustering (Jonas Bonér)
Cool session; clustering is one of the more complex area's in my current and recent projects. Terracotta seems to be capable of solving much of my problems. Terracotta offers a JVM-level clustering sollution. The speaker used scanned pencil drawings to illustrate common problems; nice. Although it was quite difficult to understand Jonas (bad acoustics, bad accent) his demo was very convincing. Tomorrow I'll at least try getting our EHCache setup to run on terracotta shouldn't be to hard, and I can't wait to see if we can get compass to run in a cluster with it. I'll come back to it.

Domain specific languages and MDA for Mule

  • Speaker presented from a laptop running ubuntu. +1
  • Speaker wasn't really capable of explaining why he did what. -1
  • Resulting code could have been impressive, but due to the example was actually not to good. -1

Ow, the speaker mentioned open archictectureware... sounded interesting; it's on my stuff-to-have-a-look-at pile.

Concurrency & Performance (Kirk Pepperdine)
Kirk talked about processors, cores, concurrency, performance. And that fact that Java manages to abstract from the low level stuff quite well. Quite a lot of technical stuff, not a lot of code.

Java Concurrency API (Paul Kramer)
Not much news here, nice to see latches and semaphores explained again and talk about ReentrantReadWriteLock a bit.

The state and future of Enterprise Java
Alef Arendsen and Joris Kuipers talked about the evolution of JEE and it's future. They stressed the fact that the talk would not be about spring. Surely the talk was about spring, but it was actually quite nice. They demonstrated the new annotations stuff for spring, and the java config module. They also did a little demo on AOP. And the ended with a nice demo of Spring/OSGi. I'll certainly start using the more compact and powerful ways for configuring Spring applications and watch out for updates on OSGi.

Conclusion
So, overall it was a nice conference. Nice but not great. I really missed the 'fun' in all the presentations. People aren't innovating; most of them are struggling to keep up. The fun and friendliness I noticed on the rubyenrails conference last week where hard to find amongst the Java people I met. Could it be the conference program (no 'new' frameworks???), or the fact that Java is professionalizing more and more? I couldn't really put my finger on it... Javapolis didn't really suffer from this problem; but they had JRuby, Grails, Rife, DWR, Phobos and many other interesting topics. Might be the program then. I'll try and see if I can make it to JFall as well.

--update--
The Finalist website has a post about JSpring in Dutch

1 comment

RubyEnRails 2007

Today I visited the (free) RubyEnRails 2007 conference. Although my day job doesn't include any Ruby or Rails at the moment I keep hoping that is will in the (near) future. During weekends and evenings I use Rails for small websites and services.

The conference opened by a keynote presented by Dr. Nic Williams; a bit chaotic here and there and not really addressing the topic ('The future of Rails') but nice the watch nevertheless.

dr. Nic on the mike

Right after the keynote Aslak Hellesøy showed us the world of RSpec. Good presentation. The concept of RSpec is basically to allow for specification driven development and during his live demo this seemed to work really well. To bad Java doesn't really have a good way to write tests before coding; the test just wouldn't compile.

A session has to be really terrible for me to leave before the end. The session about RJS was one of those. Bad examples, horrible HTML and a presenter not so gifted at speaking to an audience.

After enjoying lunch and speaking to various (ex-)colleagues/friends/other attendees I went to the 'Ruby Meets Cocoa' talk by Eloy Duran. Great stuff! With just the OSX interface builder, a couple of lines of code and active record Eloy managed to build a fat, database driven application using Cocoa within 30 minutes. I'll definitely want to play around with this! The presentation can be found here.

I decided to go to the presentation given by one of my colleagues: Camping for the rest of us. Good presentation, lot's of humor and live coding. Remco actually managed to impress me with a framework which I deemed laughable at best. There might actually be some cases were I could actually use it. No idea on how you would deploy a camping application by the way... More information about this presentation (including slides and sourcecode) can be found at Remco's blog.

The Betty Builder presentation didn't cut it for me; I just don't like graphical javascript editors messing with application code...

After a quick sprint to the 'green' conference room I managed to get into Andy's talk on Mongrel clusters. Nice to know that some people actually care about more than code and take the overall picture into account.

'Ruby Banter' started with a really horrendous joke about making RubyOnRails enterprise ready: ad a 20 msec sleep before each request. Last time I checked Java beat the crap out of Ruby performance-wise; JRuby is even reported to be faster then the MRI. The rest of the talk was filled with nice programming tricks mostly related to closures/blocks/lambda/operators (=== / <=>). Nice but not really useful.

Matthijs Langenberg did a presentation on REST/ActiveResource. I have serious doubts considering REST. The is a good reason for SOAP to have WSDL for describing services and exchange formats; REST seriously lacks this and makes cross platform communication quite painful in my opinion. For remoting between Rails applications ActiveResource seems to be quite ok.

The closing session was 'Page, Action and Fragment Caching'. Caching, in my experience one of the trickier parts of complex / clustered high traffic applications. The examples he showed where quite nice. Rails seems to have (at least functionally) caught up in the caching area. Signaling in clusters for file based caches isn't supported yet however; Action caches can use a distributed hashmap to solve this problem.

All in all I had a really nice day; learned a lot and updated my (superficial) knowledge of Rails to the latest trends. Congratulation to the people who organized the event; you did a great job!

2 comments

Photosynth

I woke up, and was blown away:

Oh, and the website can be found here but is winxp/vista only... so I cant enter. Auch.

No comments