Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too much memory usage issue #2427

Closed
gokhanabatay opened this issue Jul 7, 2020 · 7 comments
Closed

Too much memory usage issue #2427

gokhanabatay opened this issue Jul 7, 2020 · 7 comments

Comments

@gokhanabatay
Copy link
Contributor

gokhanabatay commented Jul 7, 2020

We are developing ***** system with nhibernate, our domain model has 900+ tables.
When we build session factory, sql command cache causes high memory usage issue.
Is there a way to tell NHibernate Lazy init all sql commands, when its needed?
Maybe memory cache can be used for unused sql command cleanup?

Below memory dump was taken after first request.

image

image

Duplicate queries
image

image

image

@gokhanabatay
Copy link
Contributor Author

When using "default_batch_fetch_size" config its increases memory usage too much. Without "default_batch_fetch_size" results are acceptable.

image

@hazzik
Copy link
Member

hazzik commented Jul 10, 2020

Yeah, we know. @gokhanabatay it was reported already.

Duplicate of #1316

Can you try "fix" in #1904?

@gokhanabatay
Copy link
Contributor Author

gokhanabatay commented Jul 10, 2020

Can you try "fix" in #1904?

"Agree. Better to optimize the code in batchers instead." you said in #1944
Lazy sql initialization is not implemented, only choice is to remove global default_batch_fetch_size hibernate config file?
So we remove default_batch_fetch_size in config and result are posted at previous message.
Only merged pull request is #1942 reflection performance fix with default configuration bytecode-provider=lcg(default) reflection-optimizer=true(default).

@hazzik which fix, I can try right now?

@EngSayed
Copy link

@hazzik, after adding "default_batch_fetch_size": 25 my application consumes double of the memory without using default batch size. I am not seeing a fix in #1904
Could you please let us know how to fix this while having batches?

@bahusoid
Copy link
Member

See #2959

@EngSayed
Copy link

See #2959

Yes, I just found this one and about to test it but does it go with "default_batch_fetch_size" or only use "batch_fetch_style" ?
I am guessing both properties to set, right?

@fredericDelaporte
Copy link
Member

They do not control the same thing. batch fetch size controls the batch size, and disable batching if it is 1 or less, whatever the value of the fetch style. So, you still need to specify batch sizes if you want to use batching.

The style only changes the implementation used for batching, when batching is enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants