question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Initial stream delay across NGINX proxy

See original GitHub issue

Setting up websocket communication using django-channels with NGINX as a proxy may be causing delay issues with Server-to-Client streams. The Server has to send exactly 24 messages regardless of message speed to the Client across the websocket before the Client begins to receive any data.

  • Client connected directly to Django test server streams fine
  • Client connected directly to Daphne streams fine
  • With NGINX acting as proxy neither Django test server nor Daphne server streaming works until after 24 messages have been sent from Server
  • Replaced Django server with Node.js socket server and streaming worked fine across NGINX proxy
  • Tested connection to Django server through NGINX with both browser and Node.js wscat connection and stream delay existed on both
  • If we send a message on connection (from Client to Django server) through NGINX proxy, streaming from server begins to function immediately after initial message

Given the above we believe the problem may exist within django-channels as the problem only appears when django-channels is integrated under a proxy with NGINX while Node.js client/server websocket architecture functions as expected.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
andrewgodwincommented, May 22, 2017

Ah, good to know. Thanks for leaving an update!

0reactions
MCBamacommented, May 22, 2017

Yet another Update

You probably already received an email update about my last update…but it turns out the only other change I made in addition the the version update was to change the NGINX listen port from default port 80 to port 8000 and out of curiosity I reverted that change and found out that it was actually the port change that had fixed the problem.

Thus…this is probably not your problem after all. I apologize for wasting your time chasing a wild goose.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TCP and UDP Load Balancing | NGINX Plus
Load balancing refers to efficiently distributing network traffic across multiple backend servers. In NGINX Plus Release 5 and later, NGINX Plus can proxy...
Read more >
Nginx proxy response time is very slow - Server Fault
I've found best results for ~300 req/s to be very short, around 1-3 seconds, but that will depend on your load.
Read more >
Understanding Nginx HTTP Proxying, Load Balancing ...
With buffers, the Nginx proxy will temporarily store the backend's response and then feed this data to the client. If the client is...
Read more >
How To Set Up a Reverse Proxy (Step-By-Step for Nginx ...
To understand what a reverse proxy server is, you need first to know ... For instance, if you want to watch a video...
Read more >
How to setup an Nginx reverse proxy server example
Furthermore, Nginx buffers data to help manage heavy workloads, but this may be undesirable for applications that require the lowest latency ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found