mirror of
https://github.com/wled/WLED.git
synced 2025-04-25 15:27:19 +00:00
Enable webserver queue and limits
Enable the new concurrent request and queue size limit features of AsyncWebServer. This should improve the handling of burst traffic or many clients, and significantly reduce the likelihood of OOM crashes due to HTTP requests.
This commit is contained in:
parent
1df717084b
commit
981750a48a
@ -560,8 +560,25 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define MIN_HEAP_SIZE (8k for AsyncWebServer)
|
||||
#define MIN_HEAP_SIZE 8192
|
||||
//#define MIN_HEAP_SIZE
|
||||
#define MIN_HEAP_SIZE 2048
|
||||
|
||||
// Web server limits
|
||||
#ifdef ESP8266
|
||||
// Minimum heap to consider handling a request
|
||||
#define WLED_REQUEST_MIN_HEAP (8*1024)
|
||||
// Estimated maximum heap required by any one request
|
||||
#define WLED_REQUEST_HEAP_USAGE (6*1024)
|
||||
#else
|
||||
// ESP32 TCP stack needs much more RAM than ESP8266
|
||||
// Minimum heap remaining before queuing a request
|
||||
#define WLED_REQUEST_MIN_HEAP (12*1024)
|
||||
// Estimated maximum heap required by any one request
|
||||
#define WLED_REQUEST_HEAP_USAGE (12*1024)
|
||||
#endif
|
||||
// Maximum number of requests in queue; absolute cap on web server resource usage.
|
||||
// Websockets do not count against this limit.
|
||||
#define WLED_REQUEST_MAX_QUEUE 6
|
||||
|
||||
// Maximum size of node map (list of other WLED instances)
|
||||
#ifdef ESP8266
|
||||
|
@ -874,7 +874,7 @@ WLED_GLOBAL bool ledStatusState _INIT(false); // the current LED state
|
||||
#endif
|
||||
|
||||
// server library objects
|
||||
WLED_GLOBAL AsyncWebServer server _INIT_N(((80)));
|
||||
WLED_GLOBAL AsyncWebServer server _INIT_N(((80, {0, WLED_REQUEST_MAX_QUEUE, WLED_REQUEST_MIN_HEAP, WLED_REQUEST_HEAP_USAGE})));
|
||||
#ifdef WLED_ENABLE_WEBSOCKETS
|
||||
WLED_GLOBAL AsyncWebSocket ws _INIT_N((("/ws")));
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user