The voice of a Technology Enthusiast

After a prolonged wait we have finally taken up the time to implement Real-time Collaboration for Creately. Right now the feature is in Beta and can be used by anyone who wishes to take it for a spin. The real question is why did we not do it all this time? and why have we finally done it?

For those who dont know what im talking about, real-time collaboration is the concept of being able to edit a document/file at the same time from multiple different computers while seeing changes from each editor in real-time.

It’s true that the buzz around real-time collaboration was really a while before. But thats all about the coolness of being able to work with people located in a different parts of the world at the same time on the same document and see the changes happen like magic. It was a big deal for application developers to get this working in their tools and specially when it is a cloud app. We felt the same way back when we started Creately. We had to have it because it was cool and it can create lots of buzz. But we were blocked by many factors.

What does the user really want?

From the early days we have prioritized the road map of the product based on what our users wanted. This is one of the key success factors of Creately. We payed lots of attention to support requests, discussion forums and user votes on features. This almost always decided what went into each release of Creately. Real-time collaboration as a feature did have lots of attention as well from our users. But it was not always the burning problem. Smooth collaboration was a burning problem but that didn’t always mean real-time is required. We learnt this as we started improving the collaboration features. Users wanted to be able to easily share to edit or view, to easily embed and interactively view the diagram, to be able to discuss and notify users on changes and work together. We built features that enabled all of these. Real-time collaboration always seemed like that “cool” feature and didn’t convince us a as a burning problem over most other requirements in the diagraming space.

Revenue does matter!

Thats right, you know it! Real-time collaboration as a feature didn’t make revenue sense as much as most other development we have done around Creately. Series of the initiatives we did were to deliver Creately to bug tracking and wiki platforms like Confluence, JIRA and FogBugz and also build a desktop version of Creately. It would only make sense to hit the numbers while building and delivering great products. This added on to the delays.

Why now?

Creately is doing GREAT! While things are going well we wanted to get this feature out, a long lasted wish. But most importantly as we improved collaboration features we realized always something was missing. Collaborating in real-time is not about seeing the changes and feeling the magic (so to speak), but getting something done fast and getting it done easy. The real utility in words doesn’t seem a big deal, but when you are really using it you feel the difference. It makes life just so much easier.

Lets think back. When we didn’t have cloud applications it was all emails going around with attached files. Soon you had multiple versions going around with different users edits on them. This was solved by collaborating online. You had one file that was being changed. But still you had to go back and forth after making the change to communicate with the team. This can lead to lots of time wastage if you are not communicating well. With real-time you are seeing what’s happening and ideas are communicated well and all in one session you get to create and communicate what you want. You really dont have to worry much. To feel the difference, it has to be experienced.

We are glad we did this and we have lots more planned for this year. Stay tuned!

One of the well known issues of BlazeDS is it’s limitation in scaling. To be more specific, if you are using BlazeDS for HTTP steaming using AMF, the number of concurrent streaming connections will be limited to 100s. The exact number would be dependent on multiple factors such as the capacity of the server and configuration settings on Tomcat or whatever the application server you are using. When it comes to streaming each connection would be opened and held until the client closes or the connection times out. In the case of BlazeDS this directly relates to the number of threads consumed due to how Servlets operate. Servlet consumes a thread per request and holds the thread until the request is committed. During streaming, a request is kept open throughout the streaming session which makes the servlet hold the thread through out. This particular problem cannot be solved with servlet 2.5 or before due to the limitation in Servlets itself. However Servlet 3.0 supports asynchronous requests which can be utilized efficiently to scale the same servers to support 1000s of concurrent connections.

Up to BlazeDS 4 there has not been support for endpoints that utilizes servlet 3.0. BlazeDS 4.0 turnkey ships with Tomcat 6 which uses servlet 2.5. There has been rumors that BlazeDS 4.5 will have endpoints that utilize the capability of Servlet 3.0. Still this is just a rumor and cannot be depended on. Given the current state of affairs and the growth of other frameworks and technologies I would not expect much. There have been solutions for the problem that uses various technologies and my picks are below.

  • MuleRTMP – A Google code project that uses the capabilities of Red5 streaming server and streams to AMF clients over RTMP.
  • A polling solution that uses Jetty 7 Continuations to provide an endpoint for BlazeDS
  • The Farata Systems’ solution which uses again Jetty 7 and Servelet 3 to provide a streaming endpoint for BlazeDS.
  • blazeds-servlet3-support – Another Google Code project that is a simple BlazeDS streaming endpoint that utilizes Servlet 3.

I have been personally working on the blazeds-servlet3-support project by contributing code. Right now the code looks quite messy but it works. I had to fix some of the issues and currently it is able to reliably stream messages on Tomcat 7 without causing any trouble. What this does is simply utilize the Async capability of Servlet 3 to isolate all the pushing functions into one single thread. Requests are handled and then immediately the Context of the request is handed to a the pushing thread, enabling the thread that handled the request to complete and return to the pool. This approach pretty much would allow your same server that was limited to 100s of connections to boost up to 1000s of connections. This is however not tested yet and will be done once I have completed work on the endpoint. I will run some load tests and post it up. If you wish to give this a test run here is what you need to do.

  1. Install Tomcat 7 and Blaze DS 4. The turnkey install of BlazeDS 4 is not going to work since it ships with Tomcat 6.
  2. Once you have Tomcat and BlazeDS working fine, change the Tomcat Connector configuration to use the NIO connector instead of the BIO conntector. The setting is in the server.xmland should be changed as follows.
    <!--<Connector port="8400" protocol="HTTP/1.1"
     connectionTimeout="20000" redirectPort="8443"/>-->
    <Connector connectionTimeout="20000" port="8400" 
     protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>
  3. In your Tomcat BlazeDS application context change the Servlet configuration to allow asynchronous capability for the MessageBrokerServlet. This should be done in the web.xml as follows.
    <servlet>
      <servlet-name>MessageBrokerServlet</servlet-name>
      <display-name>MessageBrokerServlet</display-name>
      <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
      <init-param>
        <param-name>services.configuration.file</param-name>
        <param-value>/WEB-INF/flex/services-config.xml</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
      <async-supported>true</async-supported>
    </servlet>
    <filter>
      <filter-name>springSecurityFilterChain</filter-name>
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
      <async-supported>true</async-supported>
    </filter>
  4. Copy the compiled blazeds-servlet3-support jar file to the WEB-INF/lib folder of the context.
  5. Change the WEB-INF/flex/service-config endpoint as follows.
    <channel-definition id="amf-stream" class="mx.messaging.channels.StreamingAMFChannel">
      <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf" 
         class="org.iobit.servlet3.endpoint.AMFServlet3Endpoint"/>
      <properties>
        <idle-timeout-minutes>3</idle-timeout-minutes>
        <max-streaming-clients>10000</max-streaming-clients>
        <server-to-client-heartbeat-millis>500</server-to-client-heartbeat-millis>
      </properties>
    </channel-definition>
  6. Restart Tomcat and you should be good to go!

Since I am continuing to work on this I would very much appreciate any feedback you might have. Please let me know your thoughts in the comments.

It’s probably a bit too late to write about this because its been more than three weeks since it happend. However something like this cannot skip my blog specially because I was one of the organizers of the event. Since we (I and Chandika) came back from Startup Weekend we have been wanting to do something similar here in Sri Lanka and the first choice was naturally a Startup Weekend. However due to many constraints we weren’t able to pull it off. One of the key reasons being the financial requirement the event had on the participants. We were not sure yet if the local tech/startup community would fancy a expensive ticket to a event of this nature. When Sanath came up with the idea to do a similar event, we all gathered up for a discussion, myself, ChandikaJeevan and Sanath and followed the birth of Colombo Hackathon.

We didn’t have much time till the event and there was much to be done. However thanks for the resourceful team that came together, we were able to get everything organized in time without having to put in much effort. Special thanks to Jeevan for providing the venue and other required arrangements. When we put out the registration form we were taken by surprise to see the number of signups that occurred during the first two days. We had hit the quota of 50 by the second day. We kept the form open and by the second week there were close to 190 registrations. We had to limit the invites to 125 due to resource limitations. On the event we had close to 80 show up and around 75 participate. During the initial pitching session there were 29 ideas that came up. 14 ideas were selected to work on during the two days. 13 ideas continued to work and produce working demos. 4 pitches won and turned home as startups! It was magic to see the kind of energy and enthusiasm that went around in the room. During the initial pitches, even-though they had never planned for it, some walked up to the front to talk about their ideas – driven by the energy in the room. This is exactly what we wanted to see and this is exactly why we did Colombo Hackathon. All in all it was a massive success and we sure plan to do it again soon!

Coming back to that, why did we do this? It’s simply because we are those geeky startup guys. We love to see ideas form and come to life. We’d love to see a startup community form in Sri Lanka and we want to see a (tiny as it may be) silicon valley in this lovely island. For the past few years myself and Chandika and many others have had this discussion. Why are there not many startups in Sri Lanka? Us being a startup that created a world renowned product, we badly needed that here. We wanted to create that here and I am glad we did this! Thanks to the inspiration from Startup Weekend India and also Venture Engine which has greatly supported this. Here is an interesting article about why startups are important.

Amidst all the excitement and energy it was sad to see quite some negativity going around. It was all mostly about the worry of one’s idea being stolen and why would one talk about it in public. There was even a blog post referencing the Winklevoss twins as an example incident of a stolen idea. Taking startup advice from one who’s only startup experience was the movie “Social Network” is like taking parental advice from Britney Spears. I get it, Facebook is what everyone knows and thats what they talk about.  Ok so lets talk about Facebook then? how authentic and unique is the idea? It’s been done a 100 times before, some quite exactly the same as Facebook. But how did Facebook become so big? A startup is not about just an idea. Ideas form every other minute. Startups are about the people! If anyone other than Mark Zuckerburg had done Facebook, it would have never gotten to where it is now and thats the fact. For a startup to be successful it takes a lot… the confidence and motivation to stand up every time you fall, relentless hard work and decisive execution, sticking around with the right people and connections and letting the wrong ones go… and lots more. If you did come to the Colombo Hackathon, you’ll know. I am very happy and excited that we were able to inspire at least eight different teams to continue executing their ideas into real businesses. Until the next Colombo Hackathon… Adios!

Startups Rock!

Colombo Hackathon Facebook Page - http://www.facebook.com/cmbHack
Colombo Hackathon Twitter - https://twitter.com/#!/cmbhack

Follow

Get every new post delivered to your Inbox.

Join 253 other followers