node-firebird icon indicating copy to clipboard operation
node-firebird copied to clipboard

Performance loss when multiple requests

Open augustosnk12 opened this issue 2 years ago • 5 comments

Hello there,

I'm facing some issue here: I have an endpoint that receives multiples requests from a lot of users. All of it is connected to a unique database.

The point is when a lot of users are send requests at the same time I can see some delay / loss of performance in the requests.

Does this lib can cause this or my issue is another thing?

augustosnk12 avatar Jan 17 '23 17:01 augustosnk12

Hi, do you are using await?

I used, and very slow, I changed and solved.

FabianoCastro avatar Jan 17 '23 20:01 FabianoCastro

@FabianoCastro you changed in order to use what?

augustosnk12 avatar Jan 17 '23 20:01 augustosnk12

Like this

returnData(aSQL:string) => { return new Promise<any[]>(async (res, rej) => { aDataBase.query(aSQL, [], async (aError: any, aRows: any[]) => { if (aErroQr) { rej(aErroQr); } else { res(aRows); } });}) }

FabianoCastro avatar Jan 17 '23 20:01 FabianoCastro

I can see in exemple too

db.query('INSERT INTO USERS (ID, ALIAS, CREATED) VALUES(?, ?, ?) RETURNING ID', [1, 'Pe'ter', new Date()], function(err, result) { console.log(result[0].id); db.query('SELECT * FROM USERS WHERE Alias=?', ['Peter'], function(err, result) { console.log(result); db.detach(); }); });

https://github.com/hgourvest/node-firebird

FabianoCastro avatar Jan 17 '23 20:01 FabianoCastro

I see it...going to try it 😉

augustosnk12 avatar Jan 18 '23 14:01 augustosnk12