Re: Flash Remoting connection performance

[email protected]
Newsgroups gmane.comp.java.openamf.user
Message-ID <[email protected]>
 
Thank you so much. This is exactly what I needed to hear.
 
Hank
 
 
In a message dated 1/29/2005 4:40:48 P.M. Eastern Standard Time,  
[email protected] writes:

> My  question is what type of connection does flash make with the server. Is 
  
> it like hitting a web page,

It's a single asynchronous HTTP  request, and I'm 90% sure it's just like
hitting a web  page.

From
http://livedocs.macromedia.com/flashremoting/mx2004/actionscript_api_reference
/mx/remoting/NetServices.html

"The  Flash application connects only when you actually make a Flash  Remoting
service function call. "

You create connections to keep  from having to send the URL, user+password, 
etc
every service request.  close just nullified the data:

From  
http://livedocs.macromedia.com/flashremoting/mx2004/actionscript_api_reference
/mx/remoting/Connection.html#connect

"close(  )  : Void
Makes the URL previously specified with the connect() method  into a null 
value,
thereby removing the connection configuration for the  remote gateway."

> or is it like establishing a persistent
>  connection. 

It doesn't open up a socket. Though Connections to Flash  Communication 
Server,
or XMLSocket do do this. I don't remember if  NetConnection could connect to
either source.

>Does this  connection really stay open on the server until you close  
> the  netconnection? If so, how burdensome is it to build and tear down this 
  
> connection. It has seemed, at times, slow to me, but I havent done  any 
real  
> testing.

So to clarify, No. Every request to  the server requires a bunch of crap in 
the
way of HTTP headers, url,  service name, etc. that would be ungainly to work
with, so the Connection  and service class abstracts away the aspects that
aren't  necessary.

> Also, how much overhead does AMF add to the process.  There must be some  
> fixed overhead, which I need to  consider.

Whatever overhead it adds is a fraction of that which would  be from using
alternate approaches (e.g. parsing XML). Having used Remoting  (with 
Coldfusion)
with large pageable recordsets (7000 rows, 30 fields) it  can cause the player
to  stall for a bit when converting the stream  into the in memory
representation, but your data may vary. Obviously the  less data you send 
across
the pipe at once the less noticiable this hang  is.

If performance is an issue, you should consider doing a version  compare for 
the
things you might possibly send. This can be very efficient  (especially if you
know how to use bitflags and Bit wise operations), so  the majority of 
overhead
is that of the package request which you'd incur  either way. e.g. you have 16
items that need to compare to the a server  which may get updated on the user
end or the server end. Since Flash uses  32 bit numbers, you can give each 
item
2 bits, one for if the client has  changed the data, the other if they server
has changed the data, and  another field for a timestamp.
Client   Server

eg.   1.1 version         1.2  version
item1:    0 - no change       0 - no  change => do nothing
item2:    0 - no change     1 - server changed => download new data
item3:     1 - client changed  0 - no change => upload new data
item4:   1 - client changed  1 - server changed => merge  data.

This approach could also be done with loadVars etc. The advantage  of remoting
is the changes in data (from either) could be sent in the  same/following
request.




=====
Troy  Gardner -"How you live your seconds, is how you live your days, is how 
you  live your life..."

http://www.troygardner.com -my  world
http://www.troyworks.com - building Rich Internet  Applications
http://www.intrio.com -helping bridge the gap between the  humans and 
machines. Home of the  Flickey™


-------------------------------------------------------
This  SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for  open source databases. Create drag-&-drop reports. Save time
by over  75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a  FREE copy at  http://www.intelliview.com/go/osdn_nl
_______________________________________________
Openamf-user  mailing  list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openamf-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.