Java Webservice Deployment Options
Sorry for the length of this, but more info is usually better than not enough...
I needed to add some server based functionality to an Android application which I have in the market. Majority of my past experience has been working with .Net web services and MSSQL, however as Android uses Eclipse & Java I decided to create this web service using similar technologies.
By using some various tutorials, I've developed a (bottom up) web service using axis2 & mySQL and it's communicating quite happily on a local instance on Tomcat7.
Deployment of the war file seems rather simple, however I'm wondering if there is anything special I need to do considering the load it's expected to handle.
The application currently has about 500,000 users each of which may make a request to the server, let's say roughly every 30 seconds. So this would currently be the heaviest traffic expected.
The web service performs a select query on the sql database, does some calculations and then sends back a response - there is no writing being done to the database at all. The expected response time is about 1-10 seconds, dependent on the complexity of the calculation.
I honestly have no idea on the load ca开发者_如何学Gopabilities of Tomcat, Java Web Service, or mySQL and some Google searching for the answers turned up nothing. But this is probably more due to the fact I didn't know exactly what to look for based on my lack of experience.
Basically I'm looking to find out if the above scenario should be handled just fine by a single instance of Tomcat, webservice and mySQL - or whether additional steps should be taken. At this point, I've no idea whether I'm well below the capabilities and don't even need to be concerned, or if I've made a bad decision moving forward this way.
So, if anyone is able to answer this query, or can just point me in the direction of where I can research this better myself, it'd be greatly appreciated.
Thanks in advance.
A good start would be to load test your web service to see how much it can handle before errors and performance suffer. You can use a tool like SoapUI for that. The SoapUI tool allows for Testing suites which can be setup to load test the web service with varying parameters. SoapUI is not limited to Java, and can be used on almost any web service.
If you find that the server can not handle the expected load then you have a few options
- Throw more hardware at it
- Tweak your queries to ensure the web service call finishes in the fastest time possible
- Profile the application to look for memory and performance bottlenecks
- Put a cache layer (See Ehcache) in front of your DB to speed up the reads.
精彩评论