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

Mt safe #22

Closed
wants to merge 4 commits into from
Closed

Mt safe #22

wants to merge 4 commits into from

Conversation

nolleh
Copy link

@nolleh nolleh commented May 31, 2016

associated with #21

The pull request contains below.

  1. The boost.asio using pattern - completion handler / intermediate handler
    Socket operation / some members need to be serialized.
    I wrapped them with strand.
    Reference : http://stackoverflow.com/questions/12794107/why-do-i-need-strand-per-connection-when-using-boostasio
  2. data accessing thread safety
    For data race condition, I've changed RedisClientImpl.state to atomic.
    If you want to serialize logic accessing state, you need to use other mechanism.

@nekipelov
Copy link
Owner

Thanks for your work!

I made benchmark (https://gist.github.com/nekipelov/d08148338716f65875bfa292181e0bf4) and got the following results:

original: ~ 25k OPS
with your code: ~ 12k OPS

This is not good. You can do mt-safe and fast?

@rpopescu
Copy link

rpopescu commented Jun 7, 2016

More importantly, does this make sense?
I don't think see the reason for this use case.
In my experience, the library and several redis connections can be used in parallel just fine in a single threaded, async IO manner without the need for expensive synchronisation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants