Richard Monson-Haefel blogged about the advantages and disadvantages of AMF versus JSON versus XML on
InsideRIA.
Also I agree with some of his points, IHMO he also misses some important ones.
For example, there is the "batch" pattern which says that it is sometimes cheaper to batch many I/O operation than to do them individually. But again using that pattern requires planning and a specific context to make it effective.
Batching is an important pattern, but the point is that the current implementations using AMF(BlazeDS) are simply Remote Procedure calls over HTTP POST.
As I said before the consequence is that BlazeDS,
does not play very well with the HTTP caching infrastructure.
In short the
POST's are never cached.
I just cannot see how
automatic batching of RPC calls can be easily implemented.
Restful API's based on JSON or XML can more easily support automatic batching and even could potentially (not sure whether the limitations of the Flex HTTPService would allow this) make use of
http pipelining.
Restful API's could also better use HTTP's caching features as well as lead to more scalable implementations on the server side, because to much state would be avoided there.
The truth is that performance differences between JSON and AMF are not that wide.
I agree, and would add "in practice" and "for most use cases".
I think that
some benchmarks are a bit misleading. Who would really want to load that much data in one request to the client, if the client typically cannot show all the data? What you want to do is to use some kind of paging or on demand loading support, because most users in typical applications are not going to look at all the data anyway.
I bet that then the differences between the formats will become minor and probably negligible as soon as you use paging or a similar mechanism.
The reference to another
performance analysis that Richard provides seems to go in this direction as well.
So at the end I would rather agree with one of the
commenters on Richard's blog
Yeah, having a JSON implementation natively in Flash would be great.
There is one other requirement that you need to take into account and that is security.
Using Webservice Remoting with authentication doesn't seem to work very well at the moment with Flex.
Therefore If you are going to use HTTP's authentication mechanism, you currently have to use BlazeDS (or the like) or use HTTPService and parse the XML manually.