Open lprhodes opened 7 years ago
Rethinkdbdash is using one connection per query. By default it will open up to 1000 connections per server - that is if you have at some time in the past 1000 concurrent queries.
I would need a bit more detail to understand your problem. What's the actual problem? Having thousands of TCP connections on a server is fine.
Hi,
I'm at a bit of a dead end with a performance issue.
I started out with a connection pool but it kept running out and I ended up needing 10k connections in the pool.
I then changed the code to create a single connection with rethinkdbdash (pool turned off) then I pass the connection too any bit of code that runs a query on rethinkDB. Unfortunately running the command
lsof -i -n | wc -l
on the rethinkdb server is showing that it still has 1300 open connections with barely anyone using the application. It seems that a TCP connection is being opened for every query but then not being closed.I had hoped to just open a single connection and then query everything through that.
Here's how I have things setup:
const rDBConnection = await rDB.connect(server)
async function doSomething (rDBConnection) { const a = await rDB.table('comment').getAll(activity.id, { index: 'activity' }).run(rDBConnection) const b = await rDB.table('taskQueue').insert(task).run(rDBConnection) const c = await rDB.table('device').getAll(user.id, { index: 'user' }).run(rDBConnection) }
doSomething(rDBConnection)