Michael Wiles Michael Wiles - 29 days ago 9
Java Question

Scalable, low overhead, high performance java persistence framework

I am looking to build a web site/application. The class model is around 100 objects and is not particularly complicated.

The web site needs to be built to handle around 30 000 concurrent users but it should potentially be able to handle more.

I would like to use a ready made persistence framework rather than write my own jdbc for accessing the database.

I have no option but to use a relational database.

I would prefer it have some form of caching baked in and would also prefer to be able to customise the sql as this is often necessary for performance tuning.

Any suggestions for what persistence framework I should use?

UPDATE: Thanks everyone. I think the ability to hand code the sql is trumps in this case. You can do some concurrency tweaking if you have access to it. While I agree, you have access to it in hibernate/jpa as well, it's the exception not the rule. myBatis is also a lighter weight, less "magic" kind of persistence framework. Furthermore, for performance and scaling reasons I don't think it wise to use too many foreign keys where the collections are managed by the persistence framework, so I probably won't use that ability in hibernate anyway. This would allow me to shard the db if necessary. I also think that myBatis is probably an easier persistence framework to master first time up. AFAIK, it doesn't have transparent persistence for example. Your answers have confirmed that there isn't another persistence framework floating around that is more suited to these requirements.

Answer Source

If hand-optimised SQL is something you want, then I suggest myBatis (formerly known as iBatis). It handles the JDBC mechanics for you, as well as the object-column mapping, using hand-written SQL that you give it.

What it won't do for you is object-relational mapping (i.e. automatic handling of associations and collections). If that's more important for you, then a JPA implementation like EclipseLink or Hibernate is the obvious choice. These can also handle custom SQL, but it's a more fiddly than with myBatis.

Both should be able to handle your load requirements without issue - the question is can your database handle it.