Giter VIP home page Giter VIP logo

Comments (3)

hiroeorz avatar hiroeorz commented on August 15, 2024

Sorry I didnt notice your message... And thanks for your message :-)

At first, I am not measuring actual speed.

////////////////
q(PoolName, Command, Timeout) ->
Worker = poolboy:checkout(PoolName),
Reply = eredis:q(Worker, Command, Timeout),
poolboy:checkin(PoolName, Worker),
Reply.
///////////////

I think that yes, the method is usually right.
And I am trying to do similarly.

But I read source code of eredis and I notice that eredis dont block receive next request, until returning result.
https://github.com/wooga/eredis/blob/master/src/eredis_client.erl

And I read document for redis, and I got to know that redis suppot pipelining server-client protocol.
http://redis.io/topics/pipelining

I think... [checkout -> eredis:q(...) -> checkin] will be repealed pipelining protocol.

And poolboy not necessary for eredis....? No. redis can receive request non-blocking but order of response is same as request order.
If big data is stored. Another response is kept waiting. So I use poolboy by a different method from usual.

And I readed source code of poolboy. Poolboy using queue:in and queue:out for management of process pool. queue:in add value to rear of queue, and queue:out removes from front of queue. So I thought that the same process did not receive a request repeatedly.
https://github.com/devinus/poolboy/blob/master/src/poolboy.erl

Now, I think [checkout -> checkin -> eredis:q(...)] logick is best method for using poolboy for eredis utilize pipelining.

Thank you :-)

from eredis_pool.

devinus avatar devinus commented on August 15, 2024

@hiroeorz It's true, you should never checkin the worker before you're done working with it. I'm unfamiliar with how eredis works, but you shouldn't rely on an internal implementation detail of Poolboy as that may change any day. I even recommend using the new poolboy:transaction/1 method. You can see an example here: https://github.com/devinus/epgsql_pool/blob/master/src/epgsql_pool.erl#L11

from eredis_pool.

hiroeorz avatar hiroeorz commented on August 15, 2024

I understand. I changed to using poolboy:transaction/2. Thank you :-)

from eredis_pool.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.