Beginner questions

#1

Hay Guys,

I am new to this community. So starting with few doubts in mind :).

I was planning to use twisted for my project but then I thought about autobahn. Web socket is one of the requirement for my project. And the other requirements include binary sockets (Unix socket), smtp and http.

So there are few questions I have to make my decision that using Autobahn is the right thing, I am doing to my project.

  1. As Autobahn extended twisted. Can I directly use the twisted apis without extending Autobahn in my project?

  2. Is it fine to listening on multiple port with multiple type of sockets (protocols) in one application (server application). For example listening 1100 for ws, 80 for http and 1200 and 1300 for unix sockets.

  3. This question is kind of replica of question 1, but still like to confirm it. I want to use Autobahn for web sockets and then twisted for binary(unix) sockets, http, and smtp protocols. Is that possible? Do I need to install anything else to implement this solution or just Autobahn?

  4. How can we cluster Autobahn and Twisted?

  5. Will Autobahn and Twisted need any coding to handle the concurrency?

  6. What is the best type of server platform to implement the solution written/using Twisted/Autobahn, Linux or Windows?

Thanks,

Chuck.

0 Likes

#2

Hay Guys,

                   I am new to this community. So starting with few

Welcome Chuck!

doubts in mind :).

I have doubts all the time;) Which is a-good-thing(tm) - unless you are trying to relaaax=)

I was planning to use twisted for my project but then I thought about
autobahn. Web socket is one of the requirement for my project. And the
other requirements include binary sockets (Unix socket), smtp and http.

Autobahn is based on Twisted, and in fact designed to work seamlessly with other parts of Twisted. It's really "batteries included" approach like Python, but on a networking level ..

  So there are few questions I have to make my decision that using
Autobahn is the right thing, I am doing to my project.

1. As Autobahn extended twisted. Can I directly use the twisted apis
without extending Autobahn in my project?

Sure.

The APIs in Autobahn are designed for that (by consuming/ providing standard Twisted Deferreds).

2. Is it fine to listening on multiple port with multiple type of
sockets (protocols) in one application (server application). For example
listening 1100 for ws, 80 for http and 1200 and 1300 for unix sockets.

Absolutely. In fact, this is what we do all the time. You can run different protocols (WS, WAMP, FTP, HTTP, IRC, SSH, ...) on different ports within the same process and you can also run different WS based protocols on the _same_ port, and also together with plain HTTP!

Like e.g.

http://myhost:9000/ws1 => my WS stuff 1
http://myhost:9000/ws2 => my WS stuff 2
http://myhost:9000/static => Twisted Web Static stuff
http://myhost:9000/ => all other URLs incl. root e.g. WSGI like Flask or Django

There are ready to run complete example for all that, like these (and the others in that examples folder):

https://github.com/tavendo/AutobahnPython/tree/master/examples/websocket/echo_site
https://github.com/tavendo/AutobahnPython/tree/master/examples/websocket/multiproto

3. This question is kind of replica of question 1, but still like to
confirm it. I want to use Autobahn for web sockets and then twisted for
binary(unix) sockets, http, and smtp protocols. *Is that possible?* Do I
need to install anything else to implement this solution or just Autobahn?

Yes, possible, and in fact designed for such use, and real-world tested!

You can do all that with Twisted+Autobahn and nothing else. You can surely add more into the mix, like Flask or Django, if you want to mashup your app with more traditional like parts. etc etc.

4. How can we cluster Autobahn and Twisted?

Short answer: not yet. Long answer: tomorrow;)

5. Will Autobahn and Twisted need any coding to handle the concurrency?

Nope. As long as your code is non-blocking and follows the asynch Twisted style, you are fine, and don't need anything else. It just works.

If you call time.sleep(10000) in your WS handler, you are screwed;)

This is Twisted asynch land .. dont block the reactor. If you need to block (because of interfacing to blocking APIs) or do CPU intensive work, there is machinery to do that on background worker thread pools without block the main reactor thread.

6. What is the best type of server platform to implement the solution
written/using Twisted/Autobahn, Linux or Windows?

Twisted and Autobahn supports all: Linux, Windows, BSDs (incl. OSX).

That being said, for high-load, massive numbers of connections, you should probably go with Linux/epoll or FreeBSD/kqueue.

My personal fav. is FreeBSD. Tavendo operates 2 test/buildslaves for the Twisted project and I wrote the kqueue reactor for Twisted (and PyPy support also). So you can be sure it'll scale;)

But we also run Twisted on Amazon EC2 Linux, and hence you can be sure Linux works just as well.

Windows: thats our dev sys, don't care for servers. OSX: don't care at all;)

We are also dedicated to support both CPython and PyPy if that matters to you.

Hope above was the kind of info you expected, pls feel free to ask more and also probably introduce yourself and/or your project. Curious;)

/Tobias

···

Am 28.10.2013 21:50, schrieb Chuck James:

Thanks,
Chuck.

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Likes

#3

Thanks a ton Tobias for your fast reply. All the informations you have provided to me, will help me big time. :).

We build video conferencing applications for corporates for their teams and clients interactions. We were using Flash technologies as of now, FMS and Flex and now we are moving forward with html5 solutions as Apple are ditching the Flash. We have all the business logic at FMS and it works really good. FMS is able to manage more than 5000 clients with video streams and chat on one server and we have about 30 FMS servers. It was all going good. But now we need to move the brain (FMS business logic) from FMS to somewhere else for Chat and all other live interactions.

I am senior technical architect and also managing the teams. We have two teams in {Java (java/grails) and php/html/js} and {Flash (FMS)/html/js and python}. The Java team is trying to build the solution but it’s just not working. Every time we change something and it break the server. So now I am planning to initiating the project in python.

As it’s a big responsibility and very big requirement. I am little nervous about it. Can python do better than Java, or is Autobahn is the right choice for this?

You provided me really good answers, but still I have one big worry, how to cluster this solution. Do you have any idea about clustered maps solution? Do we have any of them in python well tested and ready to use like hazel cast in Java. Because that could be one solution for this problem.

0 Likes

#4

Thanks a ton Tobias for your fast reply. All the informations you have
provided to me, will help me big time. :).

Great!

We build video conferencing applications for corporates for their teams
and clients interactions. We were using Flash technologies as of now,

Ahhh, Flash .. that thing I uninstalled;)

FMS and Flex and now we are moving forward with html5 solutions as Apple

Pure HTML5 is the way forward, absolutely.

are ditching the Flash. We have all the business logic at FMS and it
works really good. FMS is able to manage more than 5000 clients with
video streams and chat on one server and we have about 30 FMS servers.

Regarding "chat": I can do 50k concurrent _chat_ sessions based on WebSocket and Autobahn/Twisted on my _notebook_. This is no marketing talk: I have actually tested that. And FWIW, we tested 180k on a FreeBSD 4GB RAM, 2 core _virtual_ machine. I've mentioned that before on this list .. just in case you think 5000*30 = 150k .. and he is telling me 180k;)

If you want to do millions on chat sessions, thats a different thing. And we are working on that (infinite scale-out). But I won't announce anything until we can actually show you hard numbers.

Rgd scaling video streams over WebSocket .. see below ..

It was all going good. But now we need to move the brain (FMS business
logic) from FMS to somewhere else for Chat and all other live interactions.

I see. What about the video streams? Are you going to transport those over WebSocket as well? Since I can't see how you can get rid of Flash without getting rid of RTMP as well, and either use WebSocket or WebRTC ..

I am senior technical architect and also managing the teams. We have two
teams in {Java (java/grails) and php/html/js} and {Flash (FMS)/html/js
and python}. The Java team is trying to build the solution but it's just
not working. Every time we change something and it break the server. So

Yeah;) Java. You know, we are doing Java as well when it makes sense / there is no other way: AutobahnAndroid. Personally, I have done Java in other contexts as well, but it sucks. If you want bare metal performance, there is nothing like C/C++ (can you do vectorized SSE4 in Java? Nope. GPU kernels? Nope.) Or probably Mozilla's Rust. I have done lots and lots of C++ in the past. And still do. And will do Rust. Now you got me started on Java - it's one of my favs to pick on;)

Your Java guys will probably laugh at a little scripting language.
It's not "enterprise grade" etc etc WTF. Yeah;)

"Java developer: A Python based WebSocket server surely won't be as fast as a Java-based."

No sir. See 9.x WebSocket performance test result here:
http://autobahn.ws/testsuite/reports/servers/index.html

"Java developer: Python is interpreted and slow."

No sir. Python is a _language_ with multiple _implementation_. Enter PyPy which is a JIT compiler that achieves state of the art performance.

http://pypy.org/

Then you can accelerate hot spots and loops in your system at any time in native code:
http://cython.org/

In fact, Autobahn does use wsaccel (a native code WebSocket accelerator) for exactly this purpose.

For numeric code, here is
http://en.wikipedia.org/wiki/NumPy
http://www.numpy.org/

"Java developer: all the serious guys do Java."

No sir. Dropbox. Youtube. Google (partially). Look it up on the net.

"Java developer: it's not robust, mature."

No sir. Twisted has been around for >10 years and has been doing asynchronous networking when it wasn't yet seen as the way forward. When people did threads everywhere. When NodeJS or Netty wasn't even known to mankind.

I stop here. You know, it's that attitude: "No one got every fired for doing Java, J2EE on WebSphere and Oracle etc etc". Right. Go ahead;)

now I am planning to initiating the project in python.

Python will bring you a lot. Probably the single most important one in my experience: agility. 2nd: a large, helpful, nice community with lots of very very clever people. 3rd: batteries included.

As it's a big responsibility and very big requirement. I am little
nervous about it. Can python do better than Java, or is Autobahn is the
right choice for this?

I can feel your pain, but if you want me to give _guarantees_ without even knowing what exactly you want to do, that would be folly.

Don't believe anyone. The only thing that will give you that peace in mind is a _working prototype_ which you can hammer at. No kind of paper research or reading up will bring that.

If you are interested, you could contract us (Tavendo) for doing a design/prototype together with your Python/JavaScript devs. Then you _know_ if it works.

You provided me really good answers, but still I have one big worry, how
to cluster this solution. Do you have any idea about clustered maps
solution? Do we have any of them in python well tested and ready to use
like hazel cast in Java. Because that could be one solution for this
problem.

Hazelcast: no silver bullet. It's not like: gimme any problem, and Hazelcast will automagically make that scale. Nope sir. It all depends on the concrete, specific problem at hand. Say I want to scale video recoding. Would Hazelcast the way to go? Probably not. You might want to do that recoding on a cluster of nodes inside GPUs (think Nvidia Tesla or such).

So that then would boil down to: what is the easiest/quickest way to _drive_ 100 GPUs? I'd do the driving from Python and let the GPU do the hard work:

http://documen.tician.de/pycuda/

It will blow the shit out of a pure Java+Hazelcast system. In fact, I think GPUs would be hard to beat with anything but full custom hardware (ASICs or FPGAs) .. which will cost you big $$$.

Anyway, from the incomplete understanding of your reqs, this is how we'd approach:

- Both control/chat and video/audio is transported over WS.

- Split out those loads. They have different characteristics. The video/audio multicasting is the bottleneck and you want to scale-out _that_.

- Have a pair of master / hot-standby nodes running Autobahn for the control/chat.

- A client always connects to that master. It joins a conference there. The master will then give it the IP of the video/audio streaming node responsible for that conference. The client then opens a 2nd WS connection to it's respective conference video/audio node.

- Have N nodes exclusive for video/audio. Those connect to master, but client connect directly to the video/audio nodes. YOu can make N as large as required.

This will scale to at least 200k concurrent users including chat, control, video and audio. And: it is _simple_ and robust. And: you can direct clients to a video/audio node _near_ them, and without a load-balancer or such being in front which could bottleneck you. etc etc

If you want >200k sessions in total and/or there are more than say 1000 users in any _one_ conference, we need to rethink.

If you want us to flesh that out in detail and help you developing a working prototype, I'd love to talk to you: reach me by personal mail or on skype: toberstein

In any case, I hope I could help!

Cheers,
/Tobias

···

Am 29.10.2013 03:56, schrieb Chuck James:

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Likes