svelte-adapter-uws 0.3.8 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -291,7 +291,7 @@ The client store automatically uses `wss://` when the page is served over HTTPS
|
|
|
291
291
|
|
|
292
292
|
The Vite plugin is required for WebSocket support in both dev and production (see [Step 2](#step-2-add-the-vite-plugin-required)). It spins up a `ws` WebSocket server alongside Vite's dev server, so your client store and `event.platform` work identically to production.
|
|
293
293
|
|
|
294
|
-
Changes to your `hooks.ws` file are picked up automatically
|
|
294
|
+
Changes to your `hooks.ws` file are picked up automatically -- the plugin reloads the handler on save and closes existing connections so they reconnect with the new code. No dev server restart needed.
|
|
295
295
|
|
|
296
296
|
**Note:** The dev server does not enforce `allowedOrigins`. Origin checks only run in production. A warning is logged at startup as a reminder.
|
|
297
297
|
|
|
@@ -2219,6 +2219,7 @@ net.ipv4.tcp_max_syn_backlog = 4096 # pending TCP connection queue
|
|
|
2219
2219
|
net.ipv4.tcp_tw_reuse = 1 # reuse TIME_WAIT sockets faster
|
|
2220
2220
|
net.core.somaxconn = 4096 # listen() backlog limit
|
|
2221
2221
|
fs.file-max = 1024000 # system-wide file descriptor limit
|
|
2222
|
+
net.netfilter.nf_conntrack_max = 262144 # connection tracking table size (default 65536 fills up fast under load, drops ALL new TCP including SSH)
|
|
2222
2223
|
```
|
|
2223
2224
|
|
|
2224
2225
|
### File descriptor limits
|
|
@@ -2251,6 +2252,19 @@ Without these changes, each process is limited to 1024 file descriptors (the def
|
|
|
2251
2252
|
|
|
2252
2253
|
For a deeper walkthrough, see [Millions of active WebSockets with Node.js](https://unetworkingab.medium.com/millions-of-active-websockets-with-node-js-7dc575746a01) from the uWebSockets.js authors.
|
|
2253
2254
|
|
|
2255
|
+
### Stress testing: run it from the server
|
|
2256
|
+
|
|
2257
|
+
If you run a stress test from your local machine against a remote server, every WebSocket connection goes through your home router's NAT table. Home routers typically have 1024 to 4096 NAT entries. Once the table fills up, the router drops ALL new outbound connections -- not just your test, but SSH, your phone on WiFi, everything on your network.
|
|
2258
|
+
|
|
2259
|
+
Symptoms of NAT table exhaustion:
|
|
2260
|
+
- Connection ceiling stuck around 1200-1900 regardless of server tuning
|
|
2261
|
+
- SSH to the server times out during the test
|
|
2262
|
+
- Other devices on the same WiFi lose internet access
|
|
2263
|
+
- Server CPU is barely loaded (the server is fine, your router is not)
|
|
2264
|
+
- Switching your phone from WiFi to mobile data works immediately
|
|
2265
|
+
|
|
2266
|
+
The fix: run the stress test from the server itself (localhost to localhost) or from a machine on the same network as the server. This bypasses NAT entirely and lets you hit the actual server limits.
|
|
2267
|
+
|
|
2254
2268
|
---
|
|
2255
2269
|
|
|
2256
2270
|
## Performance
|
package/package.json
CHANGED