-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sockets: Golang rewrite and optimization #2943
Comments
|
I didn't want to keep the additional map since i don't want to risk a desync between the two at any point.
Ok. I'll keep it, on the rare chance it ends up being used. If not, it's a one-liner to remove. |
This would probably work better as a way to discuss what, if anything could be improved or fixed from the old implementation, considering this issue as is isn't much more than asking for help as it stands. |
Basically the only improvement is to fix bugs in SockJS-node or whatever else is likely to be the problem. |
I think if there are any problems with channels/sockets/subchannels, they should quickly end up apparent. When I wrote the socket multiplexer without mutex, I ended up with sockets deleted before channels, and crashing since the ...though I should really unit test that to check |
WIP Fixes smogon#2943
WIP Fixes smogon#2943
WIP Fixes smogon#2943
WIP Fixes smogon#2943
WIP Fixes smogon#2943
WIP Fixes smogon#2943
WIP Fixes smogon#2943
WIP Fixes smogon#2943
WIP Fixes smogon#2943
The way I thought of dealing with sockets/channels/subchannels ended up working out pretty badly, since only two workers at best could mutate the struct containing them concurrently. Creating a map using the parent's mock worker IDs and the structs I used would allow all workers to run concurrently while still keeping the struct's behaviour, which should be a pretty large improvement over coupling them to the workers like they were in sockets.js. Internally, Node cluster uses a net server to deal with IPC. In our case, it was using TCP handles, so I'll be using that as well unless there are better alternatives that work cross-platform. In sockets.js, I'll make a |
SockJS will only be supported on IE8 or IE9 if cookies are enabled, since sockjs-go doesn't support XDR streaming. RFC6455 is the only standard of Websocket protocol supported, so IE6-9, Chrome 6-13, Firefox <10, Safari 5, Opera <12.10, and Konqueror cannot use Websockets for SockJS connections. I may add support for these myself if this becomes a problem. Config.ssl.options will need to be modified. In Go, HTTPS servers are launched using the paths to the cert and key files, rather than their contents like in Node. |
None of those tradeoffs sound unacceptable. The real question is if it'll fix our major problems. |
What are the major problems you're thinking of? So far, I've only encountered two problems: race conditions related to Users/Rooms methods that send messages to the child process out of order, and connections not being properly closed if the child process panics. Both are relatively straightforward to solve, though. |
Our biggest problem is probably random disconnections, and also |
This should fix the deal with As for the random disconnects, I'm not positive what may be causing them. It could be sockets being prevented from sending heartbeat messages on time because of its worker's IO being starved, |
I'm thinking of splitting sockets.go into a package of a few files for the extra modularity the file needs badly at the moment and the boost in server startup time from how Go handles compiling packages compared to how it compiles sockets.go now. Making it a package would only make Go compile it if there have been any changes to the package's source code, rather than every single time the server launches like it does now. Would it be alright to do this? |
Sure. |
|
Never mind, this can be worked out for the most part using vendoring. I still want a |
I would strongly prefer for your code to be able to handle either Go or Node.js sockjs-server processes. We could then default to Node, and then we wouldn't need to support installing Go dependencies automatically. |
That's sounds more reasonable. I'll add a config setting for that |
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Work in progress. I haven't written documentation for the Go code or confirmed whether this works as intended on Windows yet. This turned into a pretty substantial refactor of the Node version of sockets-related code to not only to make using Go child processes possible, but to optimize it and make unit testing of it and any code dependent on it possible to write entirely synchronously. sockets.js and sockets-workers.js are now written in Typescript, though they won't be able to be transpiled until after Config, Users, Dnsbl, and Monitor work with it as well. Fixes smogon#2943
Is this still something still being worked on, or can it be closed?
Originally posted by @Zarel in #2444 (comment) |
Please reopen if this is still being worked on. |
The array of sockets is already stored internally in Golang as
map[string]*sockjs.session
, and I don't want to duplicate that internal map, considering it has the exact shape as what I wanted. Since Golang has the "unsafe" module, the alternative is get the raw pointers forsockjs.session
andsockjs.handler
and make them free for me to use. Which is the better way of handling this?Unit tests are provided by
go test
. The also allows benchmarking, which is imperative considering I'll need to compare whether or notsockets.go
can handle server load better than the current implementation ofsocket.js
Why don't the static servers support hosting over HTTPS? If there's no problem with it, I could implement it, since Golang can host it using both protocols.
The text was updated successfully, but these errors were encountered: