Results 1 to 5 of 5
  1. #1
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    327
    Blog Entries
    1
    Rep Power
    7

    Default How to Scalability on Java Web Service

    Hi All!


    I write and use Java Webservice to store records on database. But if number of users increase it making problem because of traffic. Please help me to find the solution Scalability on Java Web Service.


    It would be helpfulll if you could guide me on this.


    Java Code:
    import java.io.IOException;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import javax.ws.rs.Consumes;
    import javax.ws.rs.POST;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import org.json.JSONArray;
    import org.json.JSONException;
    import org.json.JSONObject;
    import com.google.gson.Gson;
    import tp.tri.ws.resumetojson_DB.DAO;
    
    @Path("/ProfileById")
    public class ProfileById {
    
    	  @POST
          @Consumes("application/json")
          @Produces("application/json")
    	public String storeProfileJSON(JsonFormat jobj_data) throws JSONException {
    		
    		Gson gson = new Gson();
    		String rsm_data_ = gson.toJson(jobj_data);
    		  
    		while(rsm_data_.contains("~"))
    		{
    			rsm_data_ = rsm_data_.replace("~", "/");
    		}
    		
    		System.out.println(rsm_data_);
    		
    		
    		JSONObject jsonObj_du = new JSONObject(rsm_data_);
    		String profile_img_ = jsonObj_du.getString("profile_img");
    		String resume_ink_ = jsonObj_du.getString("resume_ink");
    		try {
    			while(rsm_data_.contains("-"))
    			{
    				rsm_data_ = rsm_data_.replace("-", " ");
    			}
    			 JSONObject jsonObj = new JSONObject(rsm_data_);
    			 jsonObj.remove("profile_img");
    			 jsonObj.remove("resume_ink");
    			 jsonObj.put("profile_img", profile_img_);
    			 jsonObj.put("resume_ink", resume_ink_);
    			 DAO dao_ = new DAO();
    			 dao_.I_links2(data_Split(jsonObj));
    			 System.out.println(jsonObj.getString("first_name"));
    			 System.out.println(rsm_data_);
    			 
    		} catch (Exception e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    
    		return "resume_ink_";
    	}

    Thanks you.
    - Raj

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,144
    Rep Power
    12

    Default Re: How to Scalability on Java Web Service

    I can't offer specific solutions but have some things to think about. Is this a bandwidth problem or processing problem? Does the service allow for concurrent access? Usually reading isn't a problem. But updating can cause potential problems for multiple sessions updating the same data. And do you invoke a thread for each user session?

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    327
    Blog Entries
    1
    Rep Power
    7

    Default Re: How to Scalability on Java Web Service

    Hi Mr.Jim!

    Thanks for your answer. i am not using thread concept on this. That may be cause for issue..,
    - Raj

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,532
    Rep Power
    24

    Default Re: How to Scalability on Java Web Service

    Threads won't be an issue as each session will have its own thread.
    You seem to be creating a lot of intermediate JSONObjects.

    Other than that, what exact scalability issue are you encountering?
    Is it running out of memory?
    Is it slowing down?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    raj.mscking@gmail.com's Avatar
    raj.mscking@gmail.com is offline Senior Member
    Join Date
    Jan 2012
    Location
    TamilNadu
    Posts
    327
    Blog Entries
    1
    Rep Power
    7

    Default Re: How to Scalability on Java Web Service

    Hi Tolls!

    Yes, you are right. It was out of memory issue. I fixed now..,
    - Raj

Similar Threads

  1. Replies: 1
    Last Post: 10-08-2010, 03:00 PM
  2. scalability of matrix
    By ajay kumar in forum New To Java
    Replies: 1
    Last Post: 12-07-2009, 09:21 AM
  3. how to check scalability of matrix
    By ajay kumar in forum Advanced Java
    Replies: 0
    Last Post: 12-04-2009, 01:53 PM
  4. how to check scalability of matrix
    By ajay kumar in forum Java 2D
    Replies: 0
    Last Post: 12-04-2009, 07:30 AM
  5. Scalability of matrix
    By ajay kumar in forum New To Java
    Replies: 0
    Last Post: 12-04-2009, 06:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •