Archived
This forum has been archived. Please start a new discussion on GitHub.
IceInternal.BasicStream seems to hold on to objects
Hi there,
Howdy. I'm profiling the application where in I see that IceInternal.BasicStream seems to hold on to Slice defined objects which are basically domain objects acting either as input to a service request or output from a request.
The chain is shown below. This seems to hold on to these objects even after a forced GC from the profiling tool.
- IceInternal.BasicStream (#ffffae51) [Java Frame]
- _readEncapsCache IceInternal.BasicStream$ReadEncaps (#00001242)
- unmarshaledMap java.util.TreeMap (#0000150f)
- root java.util.TreeMap$Entry (#00002336)
- value model.retrieve.Request (#00009c24)
- IceInternal.BasicStream (#ffffb985) [Java Frame]
- _readEncapsCache IceInternal.BasicStream$ReadEncaps (#00000385)
- unmarshaledMap java.util.TreeMap (#00001361)
- root java.util.TreeMap$Entry (#00000d41)
- value model.retrieve.Response (#0000275b)
Any thoughts are greatly appreciated.
Thanks,
Venkatesh
Howdy. I'm profiling the application where in I see that IceInternal.BasicStream seems to hold on to Slice defined objects which are basically domain objects acting either as input to a service request or output from a request.
The chain is shown below. This seems to hold on to these objects even after a forced GC from the profiling tool.
- IceInternal.BasicStream (#ffffae51) [Java Frame]
- _readEncapsCache IceInternal.BasicStream$ReadEncaps (#00001242)
- unmarshaledMap java.util.TreeMap (#0000150f)
- root java.util.TreeMap$Entry (#00002336)
- value model.retrieve.Request (#00009c24)
- IceInternal.BasicStream (#ffffb985) [Java Frame]
- _readEncapsCache IceInternal.BasicStream$ReadEncaps (#00000385)
- unmarshaledMap java.util.TreeMap (#00001361)
- root java.util.TreeMap$Entry (#00000d41)
- value model.retrieve.Response (#0000275b)
Any thoughts are greatly appreciated.
Thanks,
Venkatesh
0
Comments
-
In Ice 2.1.0 and prior versions, the Java and C# run times actually cache BasicStream objects and eventually reuse them, which is why your objects are living longer than you might expect. Once that BasicStream instance is reused, the internal maps it keeps are cleared and your objects should be eligible for GC.
In the next release, the Ice run time will no longer cache BasicStream objects, which means any Ice objects that are created during marshaling should be eligible for GC as soon as the request completes, assuming the application isn't holding references to them.
- Mark0 -
Thanks for the quick reply. It makes sense now.
But, If say a service is gettting multiple requests, say 10 requests, I observe that 10 object instances are cached by the BasicStream.
Is this expected behavior?
Thanks,
Venkatesh0 -
Sorry, I need to correct what I stated above: the next release removes some unnecessary caching in BasicStream. However, we will make sure that BasicStream's internal tables are cleared as soon as possible.But, If say a service is gettting multiple requests, say 10 requests, I observe that 10 object instances are cached by the BasicStream.
Is this expected behavior?
Hope that helps,
- Mark0 -
Thanks for the clarification.
It means that the BasicStream cache is directly proportional to the number of Threads in the Server Thread Pool.
Will the cache be cleared when the threads are released into the thread pool?
Venkatesh0 -
Venkat Seeth wrote:Will the cache be cleared when the threads are released into the thread pool?
- Mark0 -
mes wrote:Yes. As idle threads are reaped by the Ice run time, the BasicStream objects they hold are released.
- Mark0 -
Thanks again for your clarification.
Can you throw some light on when the next version is going to be released.
This is going to affect if you have a large thread pool.
Venkatesh0 -
Hi Mark,
Howdy. I did some rudimentary load tests with about 700 requests on a server with the following config.
Version 2.1.0
Env: Win2K and Java 1.5
Ice.ThreadPool.Client.Size=30
Ice.ThreadPool.Server.Size=30
I see that there are about 122 instances of the model object sent as a parameter in request. This is more than the number of threads in the ThreadPool.
The surprising thing is the response objects created for each request are only 27, which is less than the number of threads in the ThreadPool.
There are many held on to by BasicStream as the Root in the GC path and many others held by Ice.Connection as the Root which finally has a reference to BasicStream.
Can you throw some light on this leak.
Thanks,
Venkatesh0 -
Hi,
Which tool are you using to examine the JVM state?
Have you tried running your test for a longer period of time to see if the number of objects steadily increases?
I'll look into this further.
Regarding the timing of the next release: We are in "release testing" mode now, so assuming there are no major problems discovered, I expect 2.1.1 will be released within the next two weeks.
Take care,
- Mark0 -
Which tool are you using to examine the JVM state?Have you tried running your test for a longer period of time to see if the number of objects steadily increases?I'll look into this further.I expect 2.1.1 will be released within the next two weeks.
Thanks,
Venkatesh0 -
Have you tried running your test for a longer period of time to see if the number of objects steadily increases?
I did a series of tests and I dont see that the number of objects steadily increases.
I did try reducing the number of Server Threads and the number of objects reduced too. I cannot see a pattern but it hovers around some steady number.
30 Server Threads - 120 Objects
10 Server Threads - 48 objects - stays around this though it seems to go down at times but comes back up to this number.
Hope this helps,
Venkatesh0 -
Hi Venkat,
Thanks for that.
These results are consistent with my expectations that objects are eventually released, but it would be better if they were released earlier. This will be addressed in the 2.1.1 release.
I would be interested in seeing the Slice definitions of your test case. If you don't want to post them here, feel free to send them to me by email.
Thanks,
- Mark0