-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fixes #117, HasA speedup #118
Conversation
Merging this; yes, sync.Pool could be used, but creating a hasher for short-term use per-Value isn't too costly, as that only happens on write and on iterator creation, and is 1.2 compatible. If it becomes a problem (more likely in writing) then we can reconsider 1.3 and sync pool, but the HasA fix and the bug being closed are bigger wins. |
Hi Barak, I've merged the "issue117" request to test your modifications. I see that the problem with threads-safety is solved. But another problem appears: function getsizeID() @ my dataset BEFORE the merge with "issue117" commit, gives me the following numbers for : (1) resource consuming, (2) performance, (3) a final result (1) (2) The numbers after MERGING are (2) (3) { I don't understand why after this fix, the total RES (non-swapped physical memory ) is increased from 6_44mb to 3_330mb. Why after the fix, there are only 3 threads on average with high memory consumption instead of 5 threads with low RES, what do you think? Also the performance is degraded from 15s to 30s (I think that last number might be even large, because the whole RES of VM was eaten by cayley at the 30th second ) Also, I have a question on the output JSON in the latter case: { In reality, query was executed within allowed time range ( I have used to set the configuration; Cheers, |
I've just tested the query "g.V().Has("is","ID").All(); " before applying the fix "issue117" (1) Memory consumption PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND (2) performance after applying the fix (2) |
Are you able to use go1.3 on your hosting service? If you are, would you try this branch? |
Could you reopen issue #117? I think it is not solved properly. Could try to test |
I'm running Thanks, i'll try your branch with sync.Pool. |
Hi Dan, Thanks for your modifications! (1) (2) So, comparing these numbers with ones posted previously, I conclude that your "pool" branch PR "issue117" in this particular case of g.V().Has("is","ID").All(); What concerns the parallel running, it works nice: So, perhaps this patch should be included in the next-round PR. Cheers, |
to clarify the previous post: your "pool" branch --------------- PR "issue117" |
@barakmich I'll clean up that pool branch an send a PR. It was just a rush job to see if it was the cause of the problem. Since we are now at 1.3, as you said it is now free for this change. |
I was just doing the same. I ported it to LevelDB (wholesale to the way you did it, but if you've got some cleanup I'll just drop it) and got the following numbers under -benchmem:
So yeah, let's go for it, especially since LevelDB itself now needs sync.Pool. |
If you are already there, you can do it. I won't be able to get that done for the next couple of days. |
When you say "cleanup" -- was there any renaming or such you wanted to do? Package variables make sense. |
No, it's just that I was sick when I was writing it and I had other things to do as well, so I can't guarantee the quality of the code. I just wanted to have a look to make sure there weren't things that I had missed. |
I'll PR it momentarily |
Sometimes bugs are just happy accidents. Debugging #117 I found an inner loop speedup; use the TripleDirection optimization (it's why it's there) in HasA.Next().
So I fixed the hasher contention for LevelDB and Mongo (for a small overhead, mostly on iterator creation), and, with the HasA fix, we get a really nice speedup:
Nearly 2x for free on heftier queries.
Interestingly, doing this affects the memstore. I'm not sure why that is; it shouldn't, because the implementation of TripleDirection() for memstore is precisely the same as the lines it replaced. Something weird with Go and the stack?
I dug into the profiling a little bit, but for the life of me couldn't find the slowdown. It's an interesting experiment if anyone wants to get digging.
This may also be helped by not using LLRB (ie, we might getback the performace and then some). Unclear. Still, when we're talking ~100ms difference at largest, I think it's worth doing for now, and then investigating later. Especially since the benefits for every larger/persistent store, both existing and soon-to-exist, are clear wins.
/cc @kortschak @igormarfin