-
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
Why is this execute Promise steadily increasing in execution/resolve time (resulting in NJS-040: connection request timeout error)? #474
Comments
@jonesnc I haven't poured over the code much, but I did notice that you don't seem to have a call to See the section of the doc related to promises for an example (uses close even though the connection isn't from a pool): Let's start by addressing that and then we can look at other potential issues. Also, I'll look into the dequeued count... |
@jonesnc I just ran a couple of tests on my end. The dequeued count seems to be working fine on my end, which means there's something strange going on on your side... Could you share the code you're using to run your code? What is driving/calling execute? |
I have modified my My project can be found here. |
I don't see your call to |
Ah, sorry. I'll push that change to the repo shortly. |
Ignore my deleted comment, silly mistake on my end. Let me know when you've pushed the update. |
Also, could you show the logStats output after having made that change. Here's how I would describe what happened in what you showed before:
|
I just pushed an update to the
|
Is this the best strategy for doing a large number of queries with small result size? |
I'm not sure exactly what you mean... If you mean using Please show me the updated Also, note that |
The
I'm not sure what you mean by that. Could you elaborate? Where does |
Oh, sorry. GitHub didn't push your update... It's good that we are starting to see some dequeuing. :)
Yes, this would be problematic. In the most recent _logStats output, you issued 20,320 requests over 88 seconds which is about 231 requests per second. How long do you think these queries are taking to execute? In any case, it seems like you have a flow problem. You're sending requests to the database faster than you can process them. Whatever's driving the flow should slow down and move at the speed of your database. Then you can explore means of tuning. In the example query you provided you used CONNECT BY with REGEXP_SUBSTR. See this for an alternative means of doing this: Let us know which performs better.
You're already setting maxRows, check your source. That gives you your results in an array, which is fine for you. If you had large result sets you should switch to using the ResultSet class which is described here: For clarity in your code, could you please remove all references to Orawrap? I assume you were using it at sometime but have since switched over to the core driver (which is good). |
It probably varies between the "batch" queries (those queries that use I'll try the method you suggested and report back the results, hopefully sometime tomorrow.
You're right. I'm using
Ah, I see. I misunderstood what you were saying with that. I thought you meant that it was getting set elsewhere and that I didn't need to set it. Thanks for your help, you've already helped the performance on this project greatly! |
If you are instrumenting your code, stats on connection times as well as stats on execution times would be useful. A side note: The pool stats |
I'm not sure what you mean by "instrumenting". Could you elaborate? |
Here's an old Tom Kyte post on that (the first couple paragraphs will answer your question): You've already started with some basic instrumentation with Another measurement could be added to see how long it's taking to get connections prior to execution. Then you'd have more data to help you understand what's happening. Chris has a really good point on the UV_THREADPOOL_SIZE. I would try bumping that up to be at least as high as your poolMax. Then try adjusting the size of the pool and UV_THREADPOOL_SIZE up and down to see how things perform. Just remember, more isn't always better. Try both at 50, 75, 100 - look for the sweet spot. Let us know what you get. |
@jonesnc how are you going with this? |
@cjbj Sorry I haven't updated this issue yet. I've been at a conference all week, so I haven't had a chance to carry out any of the suggestions made here. I'll try to provide an update on Friday. |
@jonesnc no problems. |
Closing due to lack of activity. |
I'm writing an ETL tool that interacts with an
Oracle
database which also usesnode-oracledb
1.10
andRxJS
to handle all of the various asynchronous data streams that I'm tossing around. I'm running into an issue where the longer my application runs, the longer a call tonode-oracledb
's.execute()
takes, and it seems to increase in running time linearly for the same query. Hopefully you can spot the mistake in the code below and correct it.First let me show how I'm running Oracle queries. I created my own
.execute()
function that acts as a wrapper aroundnode-oracledb
's.execute()
.And my
config.database.oracle
(without the credentials):Below is an example of me invoking my
.execute()
function. As you can see, there's a lot happening here, so let me try to annotate it a bit for clarity.rnd
is used to create a unique id forconsole.time()
, so I can keep track of the time it takes for the.execute()
Promise
to resolve. Let me know if there's a flaw in this time measuring technique. The bind input variable passed to theSELECT
statement is a csv string of ssid identifiers, and a list of matches will be returned. This allows me to batch process records instead of creating a single query for each individual row, hopefully saving some execution time. The first.then()
makes every key in the resulting array of objects lowercase. The second.then()
, obviously, ends theconsole.time()
tracking.Below is the
console.time()
output, which increases steadily until it hits the 60000 msqueueTimeout
limit.I added a
console.log(pool._logStats())
statement every time the.execute()
function is called. I've included the output of the last time it was printed before theNJS-040
error:It's strange that
...total requests dequeued
is0
, shouldn't that be a non-zero value?I've tried to include most of the relevant code, please let me know if you need more context.
The text was updated successfully, but these errors were encountered: