pexeer opened a new issue #1007: Hash collision degrades the performance of 
SocketMap
URL: https://github.com/apache/incubator-brpc/issues/1007
 
 
   **Describe the bug (描述bug)**
   send lots of RPC to many server(with same port) will cause high cpu and bad 
latency. 
   
   **To Reproduce (复现方法)**
   1. use channel with `single` options and  set defer_close_second to 60 
seconds.
   2. send every RPC with a new channel object and deconstruct after used. 
   3. startup a large number of server with different ip and same port.
   4. startup a BRPC client and use some thread to send large number of RPC to 
different server at the same time.
   5. high cpu usage and very high RPC latency in the client.
   
   **Expected behavior (期望行为)**
   Client latency is approximately the same as server-side latency, and normal 
cpu usage.
   
   **Additional context/screenshots (更多上下文/截图)**
   
   The main point maybe is the Hash function of EndPoint class.
   The hash function `butil::HashPair(uint32_t ip,uint32_t port)` just  connect 
two uint32_t to  a uint64_t.
   FlatMap used power rehash policy but not the prime rehash policy to speed up 
`%` operation.
   So only low address of the hash value  will be used by FlatMap.
   Total EndPoint with same port will linked by linked list in the same bucket 
of FlatMap.
   Lookup EndPoint in the SocketMap is O(n) time complexity guard by a pthread 
mutex.
   All Channel init will wait the mutex of SocketMap.
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to