-
Notifications
You must be signed in to change notification settings - Fork 63
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
dgraph4j java client first connect alpha is too slow #108
Comments
I wonder if @gitlw could have a look at this issue too. In the meantime, could you give more information on the query you're performing @willem520? Is the database already running before you connect to it, or do you also start it at the same time as you are trying to connect? |
PS: I migrated this issue to dgraph-io/dgraph4j. |
I executed a simple mutation,it also took too much time in first time |
Hey @mangalaman93 , could you have a look since you worked recently on this client? Thanks |
@willem520 Could you point me to GraphUtil code? The connection setup code is executed by grpc and not written by us in the client. Just want to make sure that the |
@mangalaman93 hi,this is the code
|
@willem520 I am looking into this issue. There is code missing for One possible explanation could be that the second time the existing connection is reused and that reduces the overall time taken. |
I used fastjson jar by alibaba. I think when it first connect to dgraph, maybe it would need init some resource(eg threadpool). and then these resources can reused. thx very much for your answer |
|
ConclusionOn further investigation, I realize that time first iteration loads libraries dynamically, links native methods which slows it down. First iteration onwards, all the libraries are loaded and time taken reduces significantly. This is expected and no change is required in the library. InvestigationJVM Options: -verbose:class -verbose:jni -verbose:gc -XX:+PrintCompilation When we run the program, it prints out all the libraries that are loaded dynamically and all the native methods that are linked dynamically. Next comment has an example output. We print I statically loaded all the libraries by using |
Logs Before
|
Logs After
|
All The Codebuild.gradle
TimeCost.java
GraphUtil.java
Issue108.java
|
Code for loading libraries
|
every time, when I used dgraph4j to connect alpha, it take too much time to get result in first time,but then ,it was normal, there is any problem in dgraph4j? I used java client
The text was updated successfully, but these errors were encountered: