joedevivo / chatterbox

HTTP/2 Server for Erlang. Boy, that guy was a real chatterbox waddn't he? I didn't think he was ever going to stop with the story.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Receive performance reduce rapidly while concurrent stream number grows

dqzjh0319 opened this issue · comments

commented

In our test, performance reduces rapidly when concurrent stream number grows.

We found the follow code block in "h2_stream_set.erl",

get_from_subset(Id, PeerSubset) ->
    case lists:keyfind(Id, 2, PeerSubset#peer_subset.active) of
        false ->
            #closed_stream{id=Id};
        Stream ->
            Stream
    end.

{StreamID, ClientPid} is stored in list struct, it can somehow explain the performance issue we met.

Our use case is gRPC unary.

I have not checked the overall usage of this data structure yet. My suggestion is general to the kind of problem,

  • Keep list data structure, use qsort like way to speed lookup
  • Replace it with map or even ets table

Thanks, yea, replacing with a map or ets table has been the plan. I've just never gotten around to my plans :( #144

There has been renewed usage of this library and I've hoped that the lack of development will change in the future.