-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
v4.01 extensive RSS memory usage #1173
Comments
@anthony-tuininga has a fix for one node-oracledb leak that will be landing soon. It is when getting Oracle Database named type information, such as with |
@cjbj not sure if the one with getDbObjectClass() is really related, at least directly I see no usage of this function across the codebase. Now I am not sure if I can provide any additional valuable information on the issue I face. Anything else I can submit to make it easier to nail down? |
@hategen, here is how you can help:
|
@cjbj Sure I will update the code and get back here With node 12 + node-oracle 4.01 the situation is the same. RSS grows rapidly. As for jemalloc and 3.12 my feelings are mixed. I faced quite a high memory consumption on the production environment and that could have been ~ 1gb per node worker, but the overall memory footprint remained quite stable and there was no grow (at least noticeable after reaching ~1GB). After installation of jemalloc RSS oscillates in 200~300 MB boundaries with some peaks under load. The whole configuration of jemaloc is quite straightforward. it has to be installed and
Flat parts of the graph represent no load. Thanks for help I will get back with more detailed data |
@cjbj So, I have updated the project so there are the changes:
rss size diff actually seems rather odd for my taste:
As for fetchArraySize seems that impacts memory consumption strongly. Reducing fetchArraySize to 100 actually makes the whole thing better Flat areas on graphs represent no load |
Yes, fetchArraySize impacts memory use considerably. That value specifies how many rows of data you wish to have fetched at a single time from the database. Memory will be allocated to support having that number of rows in memory at a single time. There is always a trade-off. Increasing that value increases the amount of memory while reducing the number of round-trips to the database. The default value of 100 is generally adequate, but you are free to tune that if you have sufficient memory and wish to increase performance. Note that there is a decreasing performance improvement as fetchArraySize is increased! |
I was able to replicate your issue and have an idea of the source of the issue -- namely the |
Good news! I was able to track down the source of the issue. The issue is in this code: diff --git a/oracle.js b/oracle.js
index 558bcfd..f7cd83a 100644
--- a/oracle.js
+++ b/oracle.js
@@ -40,7 +40,7 @@ async function query(params) {
return response.push(data);
});
- stream.on("end", function() {
+ stream.on("close", function() {
// console.log(`TOTAL ROWS: ${response.length}`);
return resolve(response);
}); You were resolving your promise in the During this investigation, we discovered that the error (NJS-018: invalid ResultSet) was not being reported and the documentation (and one example) doesn't talk about the difference between the FYI, the |
@anthony-tuininga Wow, thank you for your help. I will get back to confirm the issue resolution. |
@anthony-tuininga @cjbj Thank you for help! |
@hategen, glad to hear it worked for you, too! We'll leave this open until the new release is made that contains the fixes I mentioned. |
@hategen With the change in your code, how is memory use now in 4.0 vs 3.1.2? Is jemalloc still something you will/do use? |
Keep us posted on what you see with Node 12 (or 13). It doesn't look like jemalloc helps. |
Yay |
@cjbj, @anthony-tuininga hi again, after several days of watching memory consumption on RHEL environment the memory consumption looks so much better now. Thank you all again for the great help! |
Thanks for the update. We can keep this open until the doc & example changes have landed. Let us know what you're using node-oracledb for. It's always interesting to hear. |
So we actually build a web-app for managing land mobile radio infrastructure and our data-warehouse is an instance of Oracle DB. So our node backend interacts with the Oracle database in a quite intensive manner. |
@hategen that's really cool! |
@hategen Node-oracledb 4.1 is out with the corrected doc & examples. Thank you for all the effort you put into resolving this "subtle" problem. |
RSS memory grows intensively for node-oracledb 4.01
Hi, I have faced extensive memory consumption after migration from version 3.1.2.
This seems to be a memory allocation issue
No errors. But constant and persistent RSS memory growth
The runnable example can be found here https://github.com/hategen/node-oracledb-issue
that includes a simple script and a bunch of docker files to set-up the whole environment.
To simulate the issue follow the instructions in Readme.md
The issue is reproducible on example environment reproduces under the link and 'prod' env running on RHEL
please see memory consumption of node container after several runs of cannon npm script
JS heap size remain small and modest
Top also shows quite a bit of memory used
The same charts after some time and several more runs of cannon script
The memory consumption seem to depend strongly on oracledb.fetchArraySize
On prod, we solved the issue by downgrading oracledb package version to 3.1.2 and using jemalloc. That actually made the memory consumption stable and not grow infinitely.
With 4.0.1 both with and without jemalloc the situation remained the same.
Any ideas how to deal with this RSS memory?
On docker
On RHEL
Docker environment runs under
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Oracle version from RHEL environment:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
"CORE 11.2.0.4.0 Production"
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
The text was updated successfully, but these errors were encountered: