Fast Multisocket/Multichannel Redis PubSub Websocket Adapter#1375
Open
jonsilverman50-star wants to merge 53 commits intoamberframework:masterfrom
Open
Fast Multisocket/Multichannel Redis PubSub Websocket Adapter#1375jonsilverman50-star wants to merge 53 commits intoamberframework:masterfrom
jonsilverman50-star wants to merge 53 commits intoamberframework:masterfrom
Conversation
redis fix 3? redis fix 4? try this try this next try hacking redis adapter again try hacking redis adapter again will this fix it? better amber redis websocket patch remove extraneous puts change incorrect comment, explain how patch works in comment fiber.yields for better execution subscribe once and on the fly oopsies signed jsilver avoid namespace concerns weird code but will this work please sir, infer my type keep subscribe channel open forever take out fiber yields and subscribe in on message... will be in loop i think trying this oopsie 2 test choose function to activate better if i understand crystal-redis right this should work fix try this try this try this happy wise thinking programmer zen choice: register callback FIRST then subscribe will this wakeup websocket beat thread try something better tests for redis adapter might need this might need this 2 show heartbeat remove dead sockets fix lengthen deadbeat socket interval debug use Fiber.yield bug fix hang fix recover if the subscriber breaks dont loop in loop a good patch wit some consideration... dont get stuck anywhere better? remove race condition reset to 2am last night this might have been the only issue keep forgetting to do this autoselect adapter, subscribe early this is beginning to become hard please help i am trapped inside a computer program setup adapter early initialize and subscribe early dont load pubsub adapter yet cleanup get tests passing... ready to merge make tests fast attempt subscribe when registering message handlers remake subscription block fiber if subscribing no longer works without block make logs faster, remove unneeded puts, use logging mechanism for faster logging add logging to find out why sockets are left closed and undeleted nicer client socket we probably do need to yield in these websocket loops so pings can occur remove spam logging i added sleep the beat interval when waiting for pongs, this allows fibers to catch up and all pongs to get received, correct me if i'm wrong apparently, HTTP::WebSocket itself from Crystal core lib is doing a loop do... for its block/event loop and since im now using fibers we have to yield for the pings to come and go properly... also testing this
Removed subscriber logic for Redis channel handling.
Add conditional authentication for Redis connections
Fix nil check for client_socket and delete from client_sockets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
This is a better Redis adapter for Amber Websockets. It supposed unlimited sockets and channels and uses the Redis PubSub backend properly. In the current Redis adapter you can only subscribe to one channel. This needs merge. Also included are updates for cleaning up dead sockets and rescuing sends on dead sockets. That was needed for stability.
Please see my site https://gbalda.org for an example in production.
Alternate Designs
None.
Benefits
Speed increases for sites that use multiple sockets.
Possible Drawbacks
Only works with a process count of 1. (production.yml process_count)
Tests that I wrote long ago need fix. I'll try to fix them.