Coder Social home page Coder Social logo

memcached namespace about mcrouter HOT 8 CLOSED

facebook avatar facebook commented on May 3, 2024
memcached namespace

from mcrouter.

Comments (8)

alikhtarov avatar alikhtarov commented on May 3, 2024

@Testinos can you provide an example of how that feature would look like? One thing I can think of is adding a prefix for every key based on pool information, so for example get key sent to mcrouter would result in get user:key sent to memcached - do you mean something like that?

Note that mcrouter already supports sending to different destinations depending on the key prefix, so for example you can send get a:key to 'a' servers and get b:key to 'b' servers - see https://github.com/facebook/mcrouter/wiki/Prefix-routing-setup

from mcrouter.

Testinos avatar Testinos commented on May 3, 2024

@alikhtarov mysql memcached present namespace, namespace it is dedicated tables in database for storage data.
Example:
mysql memcached database(database: memcached, tables "sessions", "default")
telnet 127.0.0.1 11211 (one connection for next 4 steps)

  1. get @@sessions (set namespace)
  2. set test (set key for "sessions" namespace)
  3. get @@default
  4. set test1 (set key for "default" namespace)

referer: http://dev.mysql.com/doc/refman/5.6/en/innodb-memcached-intro.html (ctrl + F "Namespaces")

from mcrouter.

alikhtarov avatar alikhtarov commented on May 3, 2024

@Testinos I see. Mcrouter will already pass through those commands ("get @@namespace") to the server, so you can just proxy those requests to a mysql memcached server directly and everything will work as expected. Do you have a use case in mind where mcrouter itself should handle namespace logic?

from mcrouter.

exception0x876 avatar exception0x876 commented on May 3, 2024

@alikhtarov thing is mcrouter uses connection pooling as stated in documentation and namespaces work per connection. So mcrouter should know which namespace to use on a destination connection based on source connection namespace.

from mcrouter.

Testinos avatar Testinos commented on May 3, 2024

@exception0x876, All right.
So possible improve this in mcrouter?

from mcrouter.

Testinos avatar Testinos commented on May 3, 2024

I see implementation this, example:
*I have 4 namespace
Announce this 4 namespaces in mcrouter config, without depending Route Handles.
For every announce namespace create dedicated connection pool to memcached servers, and so if client after connect to mcrouter send command ("get @@namespace") send all traffic from this source connection to specially connection pool with command ("get @@namespace".)

from mcrouter.

alikhtarov avatar alikhtarov commented on May 3, 2024

So you can already do requests like "get @@namespace.key" using prefix routing. But there's no way to maintain state per connection like you suggest. Adding support for this is not trivial, as currently there's no correspondence between client and server connections in mcrouter by design, so that clients can share the server connections. This means that every request/reply pair is independent. If a client sends "get @@namespace", and we forward it to the server, all other clients sharing the server connection will be affected.

from mcrouter.

Testinos avatar Testinos commented on May 3, 2024

Thanks for reply.

from mcrouter.

Related Issues (20)

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.