[osflash] Next step... Flash->Flex? php+amfphp->java+openAMF?
joao.saleiro at webfuel.pt
Sun Jul 2 08:38:08 EDT 2006
Thank you Evert, excellent point of view. That's the kind of structured
opinion I was looking for. :) I'll surely take it on consideration!
From: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org] On
Behalf Of Evert | Collab
Sent: domingo, 2 de Julho de 2006 13:27
To: Open Source Flash Mailing List
Subject: Re: [osflash] Next step... Flash->Flex? php+amfphp->java+openAMF?
Yea with any platform you can create maintainable and non-maintanable code..
Its just easier with PHP because its not really strict in what it accepts..
It supports both procedural and oop code and it allows mixing HTML with
If you follow your java style of coding you can almost instantly apply it on
php.. a lot of the concepts are the same..
I probably will get a lot of bashing from this, because opinions simply
differ..But from my experience PHP is a very flexible and scalable system
for creating web applications. Where Java tries to be _the_ platform for any
problem (and they are doing a great job btw..) PHP is for me the language
for the web..
In a lot of cases the only type of clustering you need for web applications,
is on the database level. MySQL has a very simple system to distribute the
database over multiple systems.. with master-slave nodes.. This means you
can do all your SELECT queries on every database, but the INSERT, UPDATE,
and DELETE queries all have to go to the master node... This scales really
well, because the number of SELECT queries usually outnumbers the other
queries by far.
Usually, with larger (LAMP) applications, the first thing that needs to
scale is the database.. Your application can probably run on 1 PHP/Apache
server for a while (maybe a second for redundancy) but your mysql server
will be the first that hits 100% CPU.
If you have multiple PHP servers, and one of them will fail.. the other
server don't even need to know about that.. Only your loadbalancer has to
stop making requests to that server.
To see how much your memory your php application takes, install the XDebug
extension.. it has a nifty function that allows you to see the peak memory
usage for 1 request. Simply divide the RAM by that figure and you'll know
how requests you can handle at one given point (note that a request usually
only take a few dozen milliseconds when an accelerator is installed, such as
Zend's or APC). so the number for requests per minute are still a lot
For CPU usage its more difficult to predict (maybe somebody has a good
method?) but in all cases the final solution is a stress test.
As for AMFPHP.. I measured the memory usage once and it started running into
the megs for packages of the size of a few kb's. This made me start with my
own AMF library which doesnt have a framework around it (i didnt use this
anyway) and purely for serializing/deserializing amf data.. So far the
results were good, we got a 300/400% increase in speed for every AMF
request.. (this resulted in http://www.osflash.org/sabreamf/ )
There is one big issue with using AMF (at all). If the data you are
retrieving from your backend is mostly static (or doesnt change that
often) its better to use XML, because with simple XML requests you can make
use of the browsers cache..
Lots of people are forgetting the browser cache.. it can be kind of tricky
to use with PHP, but remember that for a lot of your content pages.. the
page might only update once a week or so.. You can apply the same idea with
XML files you load with flash (or LoadVars for that
matter) as long as you are using HTTP GET requests.
More information about the osflash