How to design highly scalable web services in Java?

Posted by Kshitiz Sharma on Programmers See other posts from Programmers or by Kshitiz Sharma
Published on 2012-06-19T05:56:31Z Indexed on 2012/06/26 15:24 UTC
Read the original article Hit count: 346

Filed under:
|
|
|
|

I am creating some Web Services that would have 2000 concurrent users. The services are offered for free and are hence expected to get a large user base. In the future it may be required to scale up to 50,000 users.

There are already a few other questions that address the issue like - Building highly scalable web services

However my requirements differ from the question above.

For example - My application does not have a user interface, so images, CSS, javascript are not an issue. It is in Java so suggestions like using HipHop to translate PHP to native code are useless.

Hence I decided to ask my question separately.

This is my project setup -

  1. Rest based Web services using Apache CXF
  2. Hibernate 3.0 (With relevant optimizations like lazy loading and custom HQL for tune up)
  3. Tomcat 6.0
  4. MySql 5.5

My questions are -

  1. Are there alternatives to Mysql that offer better performance for what I'm trying to do?
  2. What are some general things to abide by in order to scale a Java based web application? I am thinking of putting my Application in two tomcat instances with httpd redirecting the request to appropriate tomcat on basis of load. Is this the right approach?
  3. Separate tomcat instances can help but then database becomes the bottleneck since both applications access the same database? I am a programmer not a Db Admin, how difficult would it be to cluster a Mysql database (or, to cluster whatever database offered as an alternative to 1)?
  4. How effective are caching solutions like EHCache?
  5. Any other general best practices?

Some clarifications -

  1. Could you partition the data?

Yes we could but we're trying to avoid it. We need to run a lot of data mining algorithms and the design would evolve over time so we can't be sure what lines of partition should be there.

© Programmers or respective owner

Related posts about java

Related posts about mysql