I am new in Flex Development, While creating a new Mobile project it asks me if I want to Connect it to Some Servers and gives me four options `ColdFusion, PHP, Java and blazeDS).
I have worked in java for all the time and not a PHP fellow, I would have simply selected Java
and ignored all other. But Since efficiency is an important concern in my current project I dont want to take a chance.
According to you Which one is the best option i.e. ColdFusion, BlazeDS or Java, considering the fact that most of the time I will be storing large binary data in database i.e. Audio / Video files etc.?
Since you're a Java guy, you can immediately drop the PHP option: its AMF remoting options are slower than the other 3 and you don't want to learn a new language.
That leaves us with Java, CF, and BlazeDS, which are all basically flavors of Java and performance-wise they can be fairly similar (if used correctly: see further on):
- Java: the most basic option; I reckon it's the fastest option for AMF remoting; plus you know the language
- BlazeDS: this is actually a Java server application that allows you to push messages to the client; so you can also write in Java; but if you don't require the added functionality, don't bother
- ColdFusion: a 'productivity layer' on top of Java: whether or not you like the language is up to you to decide (I personally am not a big fan). You will have to setup a ColdFusion server. Though the developer edition of the CF server is free, the commercial edition is very expensive (unless you use Railo or BlueDragon).
But there's one thing you need to know. Instantiation in CF is terribly expensive - I mean like 500 times slower than Java -, so if you have big lists it's definitely a nono. Unless you use the trick I bumped into a few months ago: instead of instantiating an object you have to create a 'struct' and give it a '__type__' attribute.
example, instead of:
var instance = new path.to.MyClass();
//or
var instance = createObject("component", "path.to.MyClass");
do it like this:
var instance = structNew();
instance["__type__"] = "path.to.MyClass";
and ColdFusion will be just as fast - or maybe even slightly faster - then Java.
I have some benchmarks to back this up. This image is a comparison of how much time it takes to create 50000 instances in some languages. (I was actually trying to tell my boss how crappy CF really is.) And CF8 (not in the chart) is even 100 times slower.
Then I added AMF serialization and the 'typed struct' (as described earlier) to the list and this is the result:
Some column names were lost in the graphic, but the second column from the left is the pure Java option. So with this approach CF9 seems to actually be faster than Java.
I've been doing Flex -> ColdFusion for several years and while I sometimes get frustrated with coding ColdFusion, it has been great for handling the back end of Flex applications. That said, I also use BlazeDS with ColdFusion and Flex to power (push) messaging in a couple of clients.
Ultimately, I think ColdFusion (especially with the open source CFML server, Railo) is a fantastic back end (i.e, data provider) for Flex applications.