• Post Reply Bookmark Topic Watch Topic
  • New Topic

Large number of String objects  RSS feed

 
Chandra shekar M
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


I have application written in rest with Jersey-Jackson for JSON processing. All the resources

produce and consume JSON. Now, the problem is, it is a server intensive application and large number of request will be hitting the server with large JSON request object. Now, because of this reason, when the JSON object gets converted in to Java object with String fields in it mapping to JSON request values large number of string objects are getting created which is resulting in frequent GC. How to solve this problem ?


Thanks
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've only explained the scenario. What is the actual problem? Is large JSON objects choking your network bandwidth? Is JSON serialization-deserialization causing performance concerns?
 
Chandra shekar M
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is, When the JSON gets converted to Java Object, it is creating large number of String objects. How to reduce this, One way is reduce the number of
String fields in the resulting object and use primitives where ever possible.

Thanks
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chandra shekar M wrote:The problem is, When the JSON gets converted to Java Object, it is creating large number of String objects. How to reduce this, One way is reduce the number of
String fields in the resulting object and use primitives where ever possible.

Thanks


Is that large number of String objects being created is slowing your system down? You still have not mentioned what effect is caused by these large number of String objects.

As you say, using proper data types is always a good idea rather than boxing everything into a String.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!