• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Converting an ArrayList to Json Object

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My project is a struts2 webapplication with Hibernate3. The application response time is slow in few Actions, like viewing the complete list of member in a organization. Am a using an Arraylist to retrieve the list of members from a organization Table. If there are <10 records in a organization then the response page is fast, but if it exceeds more than 10 then the response is slow. Currently, we are just retrieving the list from Arraylist and then displaying results in JSP. Please suggest me, does converting the ArrayList to JSON object, and then using the JSON object results to display data in JSP's works faster or should i look for other alternative.
 
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should identify where the bottleneck is. Does the problem lie with generating the JSON, or retrieving the data or something else still? Write a couple of tests to figure out what part of the program you're not satisfied with.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Generally, it;s not a good idea to retreive a lot of objects from the DB and send it over to the UI. You should have some sort of pagination in the UI that allows the user to see a few entities at a time.

However, the limit of 10 seems too low. You will have to investigate where the bottleneck is. Database queries? Java processing? Network? maybe the javascript that parses and displays the elements is too slow.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic