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

feat: add connection pooling and idle timeout #74

Merged
merged 1 commit into from
Jan 26, 2022
Merged

Conversation

peterdeme
Copy link
Contributor

  • Add connection pooling and set an idle timeout

@peterdeme
Copy link
Contributor Author

peterdeme commented Jan 26, 2022

Okay, so my test was the following. I made a webserver which prints the socket id:

require 'webrick'

server = WEBrick::HTTPServer.new Port: 4567
server.mount_proc '/' do |req, res|
  puts "Socket: #{req.peeraddr[1]}"
  res.body = "peerport=#{req.peeraddr[1]}"
end 
server.start

Then I start off the tests:

$ export STREAM_CHAT_URL=http://localhost:4567
$ bundle exec rake test

Then checked the output:

image

☝️ As it's visible in the screenshot, the TCP sockets were re-used during the test.

If we do a test without the persistent adapter, it looks like this: 👇

image

Copy link
Contributor

@ferhatelmas ferhatelmas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ferhatelmas
Copy link
Contributor

let's port these fixes to feed SDKs similarly, it will increase performance considerably

@peterdeme peterdeme merged commit 7891005 into master Jan 26, 2022
@peterdeme peterdeme deleted the keepalive branch January 26, 2022 15:35
@github-actions github-actions bot mentioned this pull request Feb 2, 2022
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

Successfully merging this pull request may close these issues.

2 participants