Skip to content
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

crashes on large syncing #83

Closed
niktverd opened this issue Nov 19, 2020 · 4 comments
Closed

crashes on large syncing #83

niktverd opened this issue Nov 19, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@niktverd
Copy link

Dear, SvenWesterlaken!

I have faced a problem syncing 6k docs.

Everything works well on tens docs. But when I started syncing a little bigger amount of docs mongo4j stops my express server at all.
I have disconected mongo4j, added all the docs into mongo, reconnected mongo4j and faced timeout limitation.

(on video you can see how elastic search synced all the docs and mongo4j crashes after 60 seconds)
https://youtu.be/kefmJE2S6dQ

I have changed config, as shown below, but there was no effect

const mongo4j = require("mongo4j");
console.log("mongo4j is executiong....");
// mongo4j.init('neo4j://localhost', {user: 'neo4j', pass: '123'});
mongo4j.init(
    "bolt://localhost",
    { user: "neo4j", pass: "123" },
    {
        encrypted: "ENCRYPTION_OFF",
        maxConnectionLifetime: 3 * 60 * 60 * 1000, // 3 hours
        maxConnectionPoolSize: 150,
    }
);

const mongo4jDriver = mongo4j.getDriver();

console.log("mongo4jDriver", mongo4jDriver);

// create session
const s = mongo4jDriver.session();

// transaction
(async () =>{
    r = await s.writeTransaction(tx => f(tx), {
        timeout: 99999999 // define timeout
    });

})()

module.exports = mongo4j;

Do you have any idea how to overcome this obstacle?

PS. I have changed "neo4j://...." on "bolt://...." in driver config, because of this message
Neo4jError: Could not perform discovery. No routing servers available. Known routing table: RoutingTable[database=default database, expirationTime=0, currentTime=1605783019325, routers=[], readers=[], writers=[]]
as said in this article

@SvenWesterlaken
Copy link
Owner

SvenWesterlaken commented Nov 19, 2020

This looks more like an issue on neo4j side, have you looked at any issues on the neo4j driver repo?
Anyway, it could also be that it's bad on my part and that the configuration is not properly coming through as the timeout in your video shows 60000 which doesn't correspond to your number in the code above.

I actually had problems with the neo4j:// as well, but bolt should be fine to use. The newer neo4j protocol is just the same as the bolt one, but with routing added in or something, I've read. Are you running your neo4j locally or in something like Docker? because I fixed that problem for the GitHub action that releases this package which uses the Docker container of neo4j.

As with the other issues, the first moment I can look at this would be this evening.

@SvenWesterlaken SvenWesterlaken added the bug Something isn't working label Nov 19, 2020
@SvenWesterlaken
Copy link
Owner

SvenWesterlaken commented Nov 19, 2020

Also, from the top of my head, are you saving each document separately into MongoDB? Because if you use <your schema>.insertMany(documents) this will create a single query to save all the documents for both MongoDB and neo4j, which should improve performance in any case.

@niktverd
Copy link
Author

I think you are right.

I used desktop for linux neo4j.

I reinstalled neo4j from deb.repo. Launched it from shell. Increased all the parameters in neo4j.conf related to heap size to 10Gb.

And everything became ok

Thank you for you attention.

Can you close the issue?

@SvenWesterlaken
Copy link
Owner

Sure, glad you can find use in this repo btw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants