2

Here is my situation:

I wrote two REST clients in Java which are running on my server. And these clients are packaged into Runnable Jar files. I set a schedule for running it. Every time data has been synced around 3MB.

Recently, I needed to write two more clients to sync from other resources. Before that, I didn't have software architecture experience to build an efficient client System.

My problem is my server is not good for running Microsoft windows server 2003 R2. The hardware info is following:

  • CPU: Intel Xeon E5649 2.53GHZ
  • RAM: 2GB

I use MySQL database, basically the sql writes per second around 20. It is very slow. From now, doing one synchronization takes 2 hours. I could not imagine 4 REST clients running on Monday.

I need help with how to deal with four clients running on a low capacity server. However, please don't convince me to change a new powerful server :)

I have been thinking for a long time, could I only build a client which sync data from different resource? Or build four clients which running on a different schedule? The other problem is in the future more resources will be added. I don't know how to build a system with strong scalability because of my lack of knowledge.

If you could give me some advice to push my learning a little bit, it will be very appreciated. Thank you.

Further information:

The goal is to grasp data from different RESTful servers with different API and GET query rules and insert these data into Database. Thus, basically the application's job is to put data into MySQL via RESTful call.

In addition, I only focus on it. I do not need to consider about how to deal with inserted data. The structure is simply:

  • Get Restful call and get JSON format result
  • parsing JSON
  • insert into DB

I used (JAX-RS) Jersey api to implement RESTful call, and use JDBC to manage the database, but I am working on the next version which will use Hibernate to implement insert, delete, update, and search functions.

This application implementation does not use any application server. I package the program to runnable jar file, and set schedule to run it on windows server 2003.

Being a recently graduated student, that is my first REST client, but with my deep research and studying, I know more about it. However, I don't have experience on it. I just want to make it work better. Any suggestion, I appreciate it.

8
  • Please detail every rest application architecture, does it uses pure JPA? Hibernate? What Rest framework? What is the goal of these applications? What you mean by sync a resource? It read the file contents and generate SQL inserts according to it? What application server you're using? Does the data can be queries within those Rest webservices? Commented Nov 28, 2013 at 15:47
  • I'm a bit biased towards OSGi when I read this I thought of an OSGi container like Karaf; using Configuration Admin Service for each of the REST clients. This is a configuration file that spawns a new service in the container based on the file just being there and what is in the configuration file. You could also look at separating your database access into a bundle. Hope that helps. Commented Nov 28, 2013 at 15:56
  • @Tony Thank you for your quick response. I am going to take a look at OSGI. Commented Nov 28, 2013 at 15:59
  • @André Thank you for your notes. I am going to edit the question again and try to answer your question. I will try to make question more clear. Commented Nov 28, 2013 at 16:00
  • @Eric You're Welcome. I found Modular Cloud Apps with OSGi a great resource if one is getting started with OSGi -- it uses BndTools which is quite good to work with on OSGi projects. Commented Nov 28, 2013 at 16:22

1 Answer 1

1

Use a profiler to gain insight into the actual memory and CPU usage of your application. You can then decide how to improve it using the appropriate means. (F.e. multithreading, caching, compression, ...)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.