Re: WebSockets with Clojure
In our perf lab tests for a trading system we have gone up to around 10,000 concurrent connections and up to 20-40k messages per second with sub-10 millisecond latency on web sockets on a single server before things start breaking down (in this case the data is generated on another machine so the server is only connecting the web sockets to a message bus, it does not have any additional processing load). To get to that we had to navigate a number of bottlenecks such as threads switching, GC, serialization overhead and a number of other perf issues, but unless you plan on running heavy loads I don't think you need to worry about a few hundred connections. After setting up the connection, a web socket does not have a much more overhead than a normal socket, so on a big enough box your will most likely be I/O- bound. Our clients log in via a REST HTTP API, and get a web socket URI in the login response so we can easily spread the load over multiple WS servers if necessary. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: WebSockets with Clojure
On Thu, Feb 2, 2012 at 8:30 PM, Takahiro Hozumi fat...@googlemail.com wrote: 1. Resolve a server name which client should be connected to. If a client need to be connected to specific resource (chat room etc) consistent hashing is useful. http://nakkaya.com/2010/05/05/consistent-hashing-with-clojure/ (defn sha1 [obj] (let [bytes (.getBytes (with-out-str (pr obj)))] (apply vector (.digest (MessageDigest/getInstance SHA1) bytes Ouch. Not simply the Java hash function? That will work for Clojure objects that don't contain identities, only values. Whereas the above has issues with sets and maps that are semantically equal but get put together differently: user= (def x (array-map :a 1 :b 2)) #'user/x user= (def y (array-map :b 2 :a 1)) #'user/y user= (= (sha1 x) (sha1 y)) false Oopsie. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: WebSockets with Clojure
If you need scalability, two phase connect might be necessary. 1. Resolve a server name which client should be connected to. If a client need to be connected to specific resource (chat room etc) consistent hashing is useful. http://nakkaya.com/2010/05/05/consistent-hashing-with-clojure/ 2. Connect. On 2月2日, 午前7:05, blais goo...@furius.ca wrote: Hi Clojurians, Does anyone have experience with serving WebSockets from Clojure, in particular w.r.t. scalability? I'm evaluating server-side options for handling a large number of simultaneous web clients (100) and wondering how well this scales. I already hooked up Clojure to Netty and built a simple test application. I think I'll write some stress tests, but any feedback regarding how well this could scale, possible roadblocks, or experience reports would be appreciated and informative. Thanks, -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
WebSockets with Clojure
Hi Clojurians, Does anyone have experience with serving WebSockets from Clojure, in particular w.r.t. scalability? I'm evaluating server-side options for handling a large number of simultaneous web clients (100) and wondering how well this scales. I already hooked up Clojure to Netty and built a simple test application. I think I'll write some stress tests, but any feedback regarding how well this could scale, possible roadblocks, or experience reports would be appreciated and informative. Thanks, -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: WebSockets with Clojure
I haven't hooked up that many clients, but I can recommend Webbit (https://github.com/webbit/webbit) based on experience. Cheers, Jay On Wed, Feb 1, 2012 at 5:05 PM, blais goo...@furius.ca wrote: Hi Clojurians, Does anyone have experience with serving WebSockets from Clojure, in particular w.r.t. scalability? I'm evaluating server-side options for handling a large number of simultaneous web clients (100) and wondering how well this scales. I already hooked up Clojure to Netty and built a simple test application. I think I'll write some stress tests, but any feedback regarding how well this could scale, possible roadblocks, or experience reports would be appreciated and informative. Thanks, -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: WebSockets with Clojure
There's also aleph[1] which also uses netty. I'd suggest trying it, as it encapsulates websockets and other means of transportation in a clean way. (Although I have no idea how well aleph scales) [1]: https://github.com/ztellman/aleph Cheers, Moritz On Wed, Feb 1, 2012 at 23:52, Jay Fields j...@jayfields.com wrote: I haven't hooked up that many clients, but I can recommend Webbit (https://github.com/webbit/webbit) based on experience. Cheers, Jay On Wed, Feb 1, 2012 at 5:05 PM, blais goo...@furius.ca wrote: Hi Clojurians, Does anyone have experience with serving WebSockets from Clojure, in particular w.r.t. scalability? I'm evaluating server-side options for handling a large number of simultaneous web clients (100) and wondering how well this scales. I already hooked up Clojure to Netty and built a simple test application. I think I'll write some stress tests, but any feedback regarding how well this could scale, possible roadblocks, or experience reports would be appreciated and informative. Thanks, -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Moritz Ulrich -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: websockets w/ clojure
I'd missed that when it went up. Thanks for pinging the list on this. On Fri, Mar 4, 2011 at 1:49 PM, Jay Fields j...@jayfields.com wrote: I finally got around to writing this: http://blog.jayfields.com/2011/02/clojure-web-socket-introduction.html Cheers, Jay -- Forwarded message -- From: Sean Allen s...@monkeysnatchbanana.com Date: Dec 24 2010, 11:58 pm Subject: websockets w/ clojure To: Clojure Jay, Do you have any publicly released code I could take a look at? I've only found a couple of jetty/clojure/websocket examples and would love to have more I could study. -Sean- On Fri, Dec 24, 2010 at 7:53 PM, Jay Fields j...@jayfields.com wrote: I've written a few Clojure websocket apps and used Jetty. Things worked out fine and there wasn't much code at all to integrate. I'd recommend it. Sent from my iPhone On Dec 24, 2010, at 11:58 AM, Sean Allen s...@monkeysnatchbanana.com wrote: We did a prototype application using websockets for work using node.js as the server. Websocket client connects, sending some basic info... said info is used to repeatedly get new data from a database that is pushed down as it arrives in the db to the client which displays. There will be more than 1 client, each with its own data constraints that are used to get the data to send. If it goes into production we need to run on the jvm so I've been rewriting in clojure. I spent a couple hours yesterday trying to figuring out the best websockets option to use w/ the clojure based server before I gave up. I realized w/o any background I'm just running blind. Given the basic idea of the application, what is the best websockets abstraction to use w/ clojure? Aleph? The jetty websocket support? Something else? Pointers from anyone will more experience doing a websocket server in clojure greatly appreciated. Thanks, Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Fwd: websockets w/ clojure
I finally got around to writing this: http://blog.jayfields.com/2011/02/clojure-web-socket-introduction.html Cheers, Jay -- Forwarded message -- From: Sean Allen s...@monkeysnatchbanana.com Date: Dec 24 2010, 11:58 pm Subject: websockets w/ clojure To: Clojure Jay, Do you have any publicly released code I could take a look at? I've only found a couple of jetty/clojure/websocket examples and would love to have more I could study. -Sean- On Fri, Dec 24, 2010 at 7:53 PM, Jay Fields j...@jayfields.com wrote: I've written a few Clojure websocket apps and used Jetty. Things worked out fine and there wasn't much code at all to integrate. I'd recommend it. Sent from my iPhone On Dec 24, 2010, at 11:58 AM, Sean Allen s...@monkeysnatchbanana.com wrote: We did a prototype application using websockets for work using node.js as the server. Websocket client connects, sending some basic info... said info is used to repeatedly get new data from a database that is pushed down as it arrives in the db to the client which displays. There will be more than 1 client, each with its own data constraints that are used to get the data to send. If it goes into production we need to run on the jvm so I've been rewriting in clojure. I spent a couple hours yesterday trying to figuring out the best websockets option to use w/ the clojure based server before I gave up. I realized w/o any background I'm just running blind. Given the basic idea of the application, what is the best websockets abstraction to use w/ clojure? Aleph? The jetty websocket support? Something else? Pointers from anyone will more experience doing a websocket server in clojure greatly appreciated. Thanks, Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: websockets w/ clojure
Netty. Excellent library, great documentation, built-in websocket support. http://www.jboss.org/netty Example use from my work-in-progress, Cljque: https://github.com/stuartsierra/cljque/blob/master/modules/cljque-netty/src/main/clojure/cljque/netty/util.clj -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: websockets w/ clojure
I'm not sure if people are aware or not but websockets have been dropped from firefox and operahttp://hacks.mozilla.org/2010/12/websockets-disabled-in-firefox-4/ and they expect other browsers to follow. If you follow the links you can read the thread on the ietf mailing list where the paper authors, that expose a vulnerability when transparent proxies are involved, propose a different handshake for the protocol. On 29 December 2010 15:51, Stuart Sierra the.stuart.sie...@gmail.comwrote: Netty. Excellent library, great documentation, built-in websocket support. http://www.jboss.org/netty Example use from my work-in-progress, Cljque: https://github.com/stuartsierra/cljque/blob/master/modules/cljque-netty/src/main/clojure/cljque/netty/util.clj -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: websockets w/ clojure
I don't have any publicly available jetty/clojure/websocket code. I'll see if I can throw something together tomorrow. Cheers, Jay On Dec 24, 2010, at 11:58 PM, Sean Allen wrote: Jay, Do you have any publicly released code I could take a look at? I've only found a couple of jetty/clojure/websocket examples and would love to have more I could study. -Sean- On Fri, Dec 24, 2010 at 7:53 PM, Jay Fields j...@jayfields.com wrote: I've written a few Clojure websocket apps and used Jetty. Things worked out fine and there wasn't much code at all to integrate. I'd recommend it. Sent from my iPhone On Dec 24, 2010, at 11:58 AM, Sean Allen s...@monkeysnatchbanana.com wrote: We did a prototype application using websockets for work using node.js as the server. Websocket client connects, sending some basic info... said info is used to repeatedly get new data from a database that is pushed down as it arrives in the db to the client which displays. There will be more than 1 client, each with its own data constraints that are used to get the data to send. If it goes into production we need to run on the jvm so I've been rewriting in clojure. I spent a couple hours yesterday trying to figuring out the best websockets option to use w/ the clojure based server before I gave up. I realized w/o any background I'm just running blind. Given the basic idea of the application, what is the best websockets abstraction to use w/ clojure? Aleph? The jetty websocket support? Something else? Pointers from anyone will more experience doing a websocket server in clojure greatly appreciated. Thanks, Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
websockets w/ clojure
We did a prototype application using websockets for work using node.js as the server. Websocket client connects, sending some basic info... said info is used to repeatedly get new data from a database that is pushed down as it arrives in the db to the client which displays. There will be more than 1 client, each with its own data constraints that are used to get the data to send. If it goes into production we need to run on the jvm so I've been rewriting in clojure. I spent a couple hours yesterday trying to figuring out the best websockets option to use w/ the clojure based server before I gave up. I realized w/o any background I'm just running blind. Given the basic idea of the application, what is the best websockets abstraction to use w/ clojure? Aleph? The jetty websocket support? Something else? Pointers from anyone will more experience doing a websocket server in clojure greatly appreciated. Thanks, Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: websockets w/ clojure
If you decide to try Aleph and have any questions, I'm available via Github or on the mailing list at http://groups.google.com/group/aleph-lib. Zach On Dec 24, 10:55 am, paul santa clara kesseri...@gmail.com wrote: I have had a lot of success with Aleph. Just remember to clone the git repo as things move quickly and the clojars version is often out of date. Also, I would recommend taking the time to read over lamina wiki's as Aleph utilizes their channel abstractions:https://github.com/ztellman/lamina/wiki/Channels And of course:https://github.com/ztellman/aleph/wiki/HTTP good luck, -Paul SC On Fri, Dec 24, 2010 at 11:58 AM, Sean Allen s...@monkeysnatchbanana.comwrote: We did a prototype application using websockets for work using node.js as the server. Websocket client connects, sending some basic info... said info is used to repeatedly get new data from a database that is pushed down as it arrives in the db to the client which displays. There will be more than 1 client, each with its own data constraints that are used to get the data to send. If it goes into production we need to run on the jvm so I've been rewriting in clojure. I spent a couple hours yesterday trying to figuring out the best websockets option to use w/ the clojure based server before I gave up. I realized w/o any background I'm just running blind. Given the basic idea of the application, what is the best websockets abstraction to use w/ clojure? Aleph? The jetty websocket support? Something else? Pointers from anyone will more experience doing a websocket server in clojure greatly appreciated. Thanks, Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: websockets w/ clojure
I've written a few Clojure websocket apps and used Jetty. Things worked out fine and there wasn't much code at all to integrate. I'd recommend it. Sent from my iPhone On Dec 24, 2010, at 11:58 AM, Sean Allen s...@monkeysnatchbanana.com wrote: We did a prototype application using websockets for work using node.js as the server. Websocket client connects, sending some basic info... said info is used to repeatedly get new data from a database that is pushed down as it arrives in the db to the client which displays. There will be more than 1 client, each with its own data constraints that are used to get the data to send. If it goes into production we need to run on the jvm so I've been rewriting in clojure. I spent a couple hours yesterday trying to figuring out the best websockets option to use w/ the clojure based server before I gave up. I realized w/o any background I'm just running blind. Given the basic idea of the application, what is the best websockets abstraction to use w/ clojure? Aleph? The jetty websocket support? Something else? Pointers from anyone will more experience doing a websocket server in clojure greatly appreciated. Thanks, Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: websockets w/ clojure
Jay, Do you have any publicly released code I could take a look at? I've only found a couple of jetty/clojure/websocket examples and would love to have more I could study. -Sean- On Fri, Dec 24, 2010 at 7:53 PM, Jay Fields j...@jayfields.com wrote: I've written a few Clojure websocket apps and used Jetty. Things worked out fine and there wasn't much code at all to integrate. I'd recommend it. Sent from my iPhone On Dec 24, 2010, at 11:58 AM, Sean Allen s...@monkeysnatchbanana.com wrote: We did a prototype application using websockets for work using node.js as the server. Websocket client connects, sending some basic info... said info is used to repeatedly get new data from a database that is pushed down as it arrives in the db to the client which displays. There will be more than 1 client, each with its own data constraints that are used to get the data to send. If it goes into production we need to run on the jvm so I've been rewriting in clojure. I spent a couple hours yesterday trying to figuring out the best websockets option to use w/ the clojure based server before I gave up. I realized w/o any background I'm just running blind. Given the basic idea of the application, what is the best websockets abstraction to use w/ clojure? Aleph? The jetty websocket support? Something else? Pointers from anyone will more experience doing a websocket server in clojure greatly appreciated. Thanks, Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en