-
Notifications
You must be signed in to change notification settings - Fork 40
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
Share session between HTTP request in web apis / web applications #173
Comments
Hello @vzenix, Thank you for raising this request. I don't fully understand this to be honest. The HTTP API is stateless by design. We are working on an optimization with the bolt protocol, but that is still some months away from releasing. Can you test if your speed improves if you change to the neo4j or bolt scheme in your connection URL? Kind regards, Ghlen |
I try, but not, it's not a problem of the library itself, the query have a cost of time, but, in the same session neo4j use a cache system for optimize it, and if you don't close the session and you launch again this query the time uses is more less In other SGBD like mysql/mariadb you have methods for configure persistent session, don't close instantly the session, and then share session betwen separate thread of http requests I dont know how work bolt, if use a ID of session for example, an static socket for the thread or other method so i don't know if it is possible to do |
@transistive what optimizations on bolt? 😁 |
Yes, this is possible, and i was already working on it, but only on bolt. I'll just push my work on it later today. I found it to be exceptionally difficult though, and it requires some smart handling of the server states as you cannot store it with the socket. |
I had a personal use case where opening and closing of the sockets took over 40 percent of the time of each request. |
I don't understand. Persistent connection means that the server (apache) doesn't close TCP connection to database and let it use it by next request handled by php. But how you can affect from php this apache behaviour? Because the php process is not persistent. Even the bolt library is written in php, so how can you keep connection open? What am I missing? |
You can enable a socket to stay alive regardless of a php section: https://www.php.net/manual/en/function.pfsockopen.php |
So you wrote third connection class for Bolt library? ... interesting |
I pushed the work now. It is not even working and I don't have time to write up my analysis but you can check it out if you want: |
The key finding for me was that there is not a lot of control given to us by PHP to control the behavior of these sockets. Sometimes they might stay alive, sometimes not. On top of that their ID may or may not be unique, so it is very difficult to provide a second layer to attach the server state to. |
I'll take a look at it later (hopefully this week). I'm really curious. Did you tried to ask me how to deal with this problem in past? |
Is your feature request related to a problem? Please describe.
I have complex queries, the first execution in a session it consume to much time, but next time execute it fast in the same HTTP Request, but when y start a new HTTP, the library create a new session, and again the query work slow, I have this time for example in complex queries
Describe the solution you'd like
Share session between diferent http request
Describe alternatives you've considered
I have not an alternative, i need do complex queries.
Additional context
Thanks for all
The text was updated successfully, but these errors were encountered: