-
Notifications
You must be signed in to change notification settings - Fork 231
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
Support show bytes sent/received on the connection #627
Comments
@Defined2014 @xiongjiwei ptal |
Is this added to every TCP connection? Will it be too heavy to add atomic variables here which have a big impact on performance? |
It should be an option like WithDialer or something, but when it enables, all connections to the endpoint should use the atomic counter. And I think the performance is not a big problem, because IO duration is much higher than atomic operations |
It sounds okay but I'm not sure whether it is a better idea to count at upper layers for more flexibility. If one client could support multiple tenants, counting bytes by connection may be not enough. |
Agree. Do you have a spec about this requirement? I am not fully understand about this feature. According to my understanding, a TiDB-Server may only have one tenant, do we need to count traffic by TCP connection, maybe by instance is enough (not sure)?. |
As my plan, it's used by lightning to import data to tikv. We want to know the network IO of this import task |
Is precision so important that we must wrap the connection? The protobuf bytes |
good point. I'm thinking of another example: if there are problems with environment and lead to network reconnection or data retransmission, we should not charge users for it. |
Due to some billing requirements, I want to know how many bytes this client sent/received with TiKV. Currrently I want to wrap a
net.Conn
with customizedRead
Write
method to add the IO byte number to an atomic variable, likehttps://github.com/pingcap/tiflow/blob/7f27730235f94859692b9da561f50c491e483427/dm/syncer/dbconn/utils.go#L102-L127
Is this OK? can you give some advice
The text was updated successfully, but these errors were encountered: