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

add monitor feature #652

Open
kukey opened this issue Sep 21, 2021 · 2 comments
Open

add monitor feature #652

kukey opened this issue Sep 21, 2021 · 2 comments

Comments

@kukey
Copy link
Contributor

kukey commented Sep 21, 2021

problem:
In some cases, we need to view real-time requests, but twemproxy don`t support it!

Solution:
Provide monitor command like redis monitor command and return.
I have implemented the redis part , like this:

微信图片_20210921134710

I`ll sort my code and send it out!
@TysonAndre
Copy link
Collaborator

Depends on the implementation, there's a lot of edge cases and tradeoffs to worry about. I can't make any guarantees

  1. Depending on how it's implemented, it may slow down the vast majority of use cases that don't use this, though it might be acceptable for some implementations. Any implementation that slowed down or blocked requests from other clients to twemproxy (or potentially crashed twemproxy when running on a production server) would also be a concern. It would also some ongoing maintenance effort. Edge cases also need to be handled, e.g. what to do about a client when we can no longer send it response data when TCP buffers fill up (drop the client? Drop the messages?) or how to handle multiple clients (linked list?)
  2. Memcache protocol has no way to run a monitor command, but that can be omitted
  3. Supporting this in the event loop and verifying the implementation is correct may be inconvenient due to needing to write everything in C (which will not change)

@kukey
Copy link
Contributor Author

kukey commented Sep 22, 2021

  1. yeap, it may slow down the proxy when that only have some monitor clients. I understand mointor it is only used temporarily.
  • I use the rbtree to save the conn info, the key is conn->fd, the value is the client conn pointer. Not use linked list becacuse the time complexity is 0(n).
  • When a monitor client close, drop the client.
  • All requests are async, not block the client. (use fake request)
  1. yeap, the monitor command is only for twemproxy, support memcache is easy

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

No branches or pull requests

2 participants