Skip to content

MaxConnectionPoolSize is not respected under heavy load #501

Closed
@aaronjwood

Description

@aaronjwood

The default internal connection pool size for this driver seems to be set at 100. I'm seeing that this can be broken. Basic test to reproduce this behavior:

    test('Connection pool', async () => {
        const driver = Neo4J.driver('bolt://localhost:7687', Neo4J.auth.basic('neo4j', 'neo4j'), {
            disableLosslessIntegers: true,
        });

        const p: Promise<any>[] = [];
        for (let i = 0; i < 1500; i++) {
            p.push(new Promise(async (res, rej) => {
                const session = driver.session();
                await session.run('MATCH (n) RETURN n');
                session.close();
                res();
            }));
        }

        await Promise.all(p);
    }, 30000);

Watch netstat while you run this test and see that the number of connections goes into the thousands:

watch -n .5 'netstat -an | grep "7687" | grep ESTABLISHED | wc -l'

I've tested this against Neo4j 3.5.3 and 3.5.12 using driver versions 1.7.5 and 4.0.0-beta01.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions