Is there a way to apply GenStage's back pressure mechanism on phoenix channel?

First I got to say, Elixir is amazing! Recently my boss asked me to analyze a NGINX log file and visualize it. So basically I parsed result from running Rails and Grape’s list routes command and write macro to turn them into a function to match the URLs in the NGINX log file. And I’m running the functions in Flow to parse the log. In the Flow.reduce every time one line got parsed it will push a channel message to front end which is implemented by Elm. But it’s so fast that tens of thousands of messages got pushed to Elm and crash Chrome. So my question is that: is there a way to apply GenStage’s back pressure mechanism on phx channel so I don’t crash Chrome with too many channel message and then I can do the real time rendering to visualize the log?

4 Likes