Comments (5)
Thank you for the update. I will try to make stress testing and will update.
from ws-tcp-relay.
Here is the Docker image that I'm using for the testing. Unfortunately, I didn't get to do stress testing so far because I only have one application that connects via WebSocket.
from ws-tcp-relay.
- Unfortunately I haven't done any stress testing; I haven't yet tried to use this in a large scale project, so that's a bit of uncharted territory. This code is extremely simple though, so I imagine a single instance can handle however many concurrently open connections
golang.org/x/net/websocket
can handle. - Connections are opened as soon as a websocket opening handshake is received (this is handled by
golang.org/x/net/websocket
).ws-tcp-relay
doesn't know anything about NATS since all it does is stream data between websockets and TCP. With regard towebsocket-nats
, this indeed happens duringnats.connect(...)
, which internally opens the websocket. - Connections are kept open as long as both the websocket and TCP connections remain open. Either the client or server can terminate the connection at any time, so for usage with NATS,
gnatsd
should handle timeout and keep-alive. Otherwise, it appears thatgolang.org/x/net/websocket
does not implement ping/pong messages, so it may be worth investigating replacing that with something likegithub.com/gorilla/websocket
.
That all being said, your approach sounds like the right way to go, although I would do the "connect to a ws-tcp-relay
instance randomly" part using a load balancer rather than in the client. I would be interested to see how you're setting up your Docker instances, it may be helpful for others to include a simple Dockerfile in the project. Also, would it be easier if I published binaries?
from ws-tcp-relay.
Hi @isobit, thank you for your prompt response. I'll be happy to do some stress testing ;-). Below are some Bash scripts I'm using to get Docker to launch 10 instances of the relay server:
First, you need to launch NATS using Docker:
#!/usr/bin/env bash
docker run -d --rm --name="nats-server" --memory=128M -p 4222:4222 -p 8222:8222 nats
#!/usr/bin/env bash
SERVERS=10
NATS_SERVER_IP="0.0.0.0"
RELAY_SERVER_PORT=6001
COUNT=0
while [ $(($COUNT < $SERVERS)) == 1 ];
do
docker run -it --rm --name="nats-relay-$COUNT" --memory=128M -p $RELAY_SERVER_PORT:$RELAY_SERVER_PORT golang sh -c "go get github.com/joshglendenning/ws-tcp-relay && exec ws-tcp-relay -p $RELAY_SERVER_PORT $NATS_SERVER_IP:4222"
echo -e "[$COUNT] - WS-TCP RELAY [$RELAY_SERVER_PORT] STARTED";
COUNT=$(($COUNT + 1))
RELAY_SERVER_PORT=$(($RELAY_SERVER_PORT + 1))
done
then you can use docker stats
to see the containers running.
I'm in the process of documenting my setup and I will be happy to share it when ready.
from ws-tcp-relay.
Hey, I'm very interested in stress testing. please share your results
Thank you!
from ws-tcp-relay.
Related Issues (10)
- Segmentation fault in AMD64 and Intel X86 on OSX M1 chip HOT 2
- Send data from WebSocket to TCP Server successfull but fail with vice-versa HOT 1
- binary data isn't working HOT 3
- Use io.CopyBuffer() instead of io.Copy()? HOT 2
- Add support for TCP TLS HOT 1
- General question HOT 2
- Benchmark against Websockify
- Listen port issue HOT 1
- Please provide a concrete example HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ws-tcp-relay.