Home > Flash Platform, Zend_Amf > 10X Zend Amf Performance enhancements — please test!

10X Zend Amf Performance enhancements — please test!

January 18th, 2010

Mark Reidenbach from everytruckjob.com has submitted a awesome patch for Zend Amf that creates a huge performance increase. Thanks so much Mark! I have also added a reference check optimization that uses SPL_object_hash to quickly see if an object has been seen before or not. Overall you should see a big performance increase. The test case I used was the James Ward’s census data from my ZendCon talk which consists of random people objects ranging from 1 – 100 duplicates totaling 5k total rows.  Xdebug profiling analyzed by  KCacheGrind showed roughly a 10X increase in performance!

The question is did all of these changes introduce any bugs? I have not been able to find anything and all of the tests pass. However with such a major change I would really appreciate you downloading the attached file and overwriting Zend/Amf/* with it’s contents. Please report any issues in the comments here or better yet on the actual bug ZF-7493 If all goes well we will try and get this into the 1.10 release.

Amf_performace.zip

Flash Platform, Zend_Amf

  1. Bjoern
    January 18th, 2010 at 02:56 | #1

    Hi Wade,
    good to see that Zend_Amf is still under development. Unfortunately I can’t get the patched version to work. After I overwrote the Zend/Amf folder with the contents of the archive my Flex app throws this error:

    (mx.messaging.messages::ErrorMessage)#0
    body = (Object)#1
    clientId = (null)
    correlationId = “3F9468BF-3994-0979-FE8F-4067F8100A29″
    destination = “”
    extendedData = (null)
    faultCode = “Server.Acknowledge.Failed”
    faultDetail = “Was expecting mx.messaging.messages.AcknowledgeMessage, but received null”
    faultString = “Didn’t receive an acknowledge message”
    headers = (Object)#2
    messageId = “3188A43F-EDB2-BBDD-E4CF-4067F860227B”
    rootCause = (null)
    timestamp = 0
    timeToLive = 0

    Using Charles I can see that the response of my Amf service is null and there are no errors. Any hints?

    Best regards,
    Bjoern

  2. January 18th, 2010 at 15:53 | #2

    @Bjoern Do you know what release your currently using? This is based off of the latest 1.10 beta1 http://devzone.zend.com/article/11642-Zend-Framework-1.10.0beta1-Released

  3. matthias
    January 18th, 2010 at 21:30 | #3

    Using ZAMF-Browser i get the same error. I used the latest zendfw (1.10.0beta1) and the patch.

    Interestingly enough, my own flex-application works.

    There was an error loading the server’s info. Error: (mx.rpc.events::FaultEvent)#0
    bubbles = false
    cancelable = true
    currentTarget = (mx.rpc.remoting.mxml::RemoteObject)#1
    channelSet = (mx.messaging::ChannelSet)#2
    authenticated = false
    channelIds = (Array)#3
    [0] (null)
    channels = (Array)#4
    [0] (mx.messaging.channels::AMFChannel)#5
    authenticated = false
    channelSets = (Array)#6
    [0] (mx.messaging::ChannelSet)#2
    connected = true
    connectTimeout = -1
    enableSmallMessages = true
    endpoint = “http://…………../gateway.php”
    failoverURIs = (Array)#7
    id = (null)
    mpiEnabled = false
    netConnection = (flash.net::NetConnection)#8
    client = (mx.messaging.channels::AMFChannel)#5
    connected = false
    maxPeerConnections = 8
    objectEncoding = 3
    proxyType = “none”
    uri = “http://…………../gateway.php”
    piggybackingEnabled = false
    polling = false
    pollingEnabled = true
    pollingInterval = 3000
    protocol = “http”
    reconnecting = false
    recordMessageSizes = false
    recordMessageTimes = false
    requestTimeout = -1
    uri = “http://…………../gateway.php”
    url = “http://…………../gateway.php”
    useSmallMessages = false
    clustered = false
    connected = true
    currentChannel = (mx.messaging.channels::AMFChannel)#5
    initialDestinationId = (null)
    messageAgents = (Array)#9
    [0] (mx.rpc::AsyncRequest)#10
    authenticated = false
    autoConnect = true
    channelSet = (mx.messaging::ChannelSet)#2
    clientId = (null)
    connected = true
    defaultHeaders = (null)
    destination = “AMF”
    id = “2D1CCD62-E448-16FD-79B8-4465C9CE0DDB”
    reconnectAttempts = 0
    reconnectInterval = 0
    requestTimeout = -1
    subtopic = “”
    concurrency = “multiple”
    destination = “AMF”
    endpoint = “http://…………../gateway.php”
    getServices = (mx.rpc.remoting.mxml::Operation)#11
    argumentNames = (Array)#12
    arguments = (Object)#13
    concurrency = “multiple”
    lastResult = (null)
    makeObjectsBindable = true
    name = “getServices”
    service = (mx.rpc.remoting.mxml::RemoteObject)#1
    showBusyCursor = true
    makeObjectsBindable = true
    operations = (Object)#14
    getServices = (mx.rpc.remoting.mxml::Operation)#11
    requestTimeout = -1
    showBusyCursor = true
    source = “ZendAmfServiceBrowser”
    eventPhase = 2
    fault = (mx.rpc::Fault)#15
    content = (Object)#16
    errorID = 0
    faultCode = “Server.Acknowledge.Failed”
    faultDetail = “Was expecting mx.messaging.messages.AcknowledgeMessage, but received null”
    faultString = “Didn’t receive an acknowledge message”
    message = “faultCode:Server.Acknowledge.Failed faultString:’Didn’t receive an acknowledge message’ faultDetail:’Was expecting mx.messaging.messages.AcknowledgeMessage, but received null’”
    name = “Error”
    rootCause = (null)
    headers = (null)
    message = (mx.messaging.messages::ErrorMessage)#17
    body = (Object)#16
    clientId = (null)
    correlationId = “06927F94-0A5F-A7AC-EAA6-4465C9CFB388″
    destination = “”
    extendedData = (null)
    faultCode = “Server.Acknowledge.Failed”
    faultDetail = “Was expecting mx.messaging.messages.AcknowledgeMessage, but received null”
    faultString = “Didn’t receive an acknowledge message”
    headers = (Object)#18
    messageId = “A2AAC85B-DA13-57AE-45A9-4465D0C4D16C”
    rootCause = (null)
    timestamp = 0
    timeToLive = 0
    messageId = “A2AAC85B-DA13-57AE-45A9-4465D0C4D16C”
    statusCode = 0
    target = (mx.rpc.remoting.mxml::RemoteObject)#1
    token = (mx.rpc::AsyncToken)#19
    message = (mx.messaging.messages::RemotingMessage)#20
    body = (Array)#21
    clientId = (null)
    destination = “AMF”
    headers = (Object)#22
    DSEndpoint = (null)
    DSId = “nil”
    messageId = “06927F94-0A5F-A7AC-EAA6-4465C9CFB388″
    operation = “getServices”
    source = “ZendAmfServiceBrowser”
    timestamp = 0
    timeToLive = 0
    responders = (null)
    result = (null)
    type = “fault”

  4. Bjoern
    January 19th, 2010 at 02:16 | #4

    Ahh! I didn’t pay attention to this, sorry. I am using the latest stable so I’ll give the beta a try. Thanks for your reply.

  5. Wessel
    January 19th, 2010 at 06:20 | #5

    We tried it, the suggested zendamf beta works, but this patch returns null on every request with us also.

  6. January 19th, 2010 at 08:59 | #6

    I’ve just tried this with the 1.10 beta1 and get the same error

  7. MartinMc
    January 21st, 2010 at 18:25 | #7

    Received the same outcome as @Bjoern. Test was worked fine with 1.10 Beta before overwriting the Amf files.

  8. Bjoern
    January 22nd, 2010 at 06:55 | #8

    Same here. Applied the patch to 1.10 RC1 and null is returned on every request.

  9. Nabeel
    January 24th, 2010 at 07:13 | #9

    It doesn’t work my flex applications gives me fault errors every request to the AMF !!!!!

  10. January 27th, 2010 at 15:14 | #10

    Did this improvement and patch make it into the 1.10 release?

    http://devzone.zend.com/article/11727-Zend-Framework-1.10.0-STABLE-Released

  11. January 29th, 2010 at 06:55 | #11

    Is this patch included in the actual 1.10 release?

  12. February 2nd, 2010 at 04:49 | #12

    Hi, I’m trying to migrate from AMFPHP to Zend Amf. So far I’ve been able to clear all the Bad.Version issues and am receiving the output on the flash side. However the data is somewhat inconsistent.

    From an AS3 point of view I should receive an array of objects. Those objects all have different sets of properites inside them, but a lot, BUT NOT ALL of those properties are common to all objects. However it looks like the properties that DON’T EXIST in the first object of the array are stripped out from the other objects.
    Any ideas?

    P.S. All works fine with AMFPHP.

  13. Shinan
    February 3rd, 2010 at 12:27 | #13

    @Thomas I am thinking it did not make it in 1.10. The bug that the patch refers to is “In Progress”

  14. Otto
    February 5th, 2010 at 05:41 | #14

    I’ve patch together something that works for me (1.10 stable):
    http://www.mediafire.com/?mqji3wymnzh

    Huge thanks for these patches btw, it makes a world of difference.

    Used patches:
    Amf.Combined-NoObjectsByRef.diff (made it much faster for me)
    Amf.perform.ref-writeString.diff (only slightly faster)

  15. averger
    February 5th, 2010 at 08:04 | #15

    What’s the actual status of this performance bug correction ? I’ve try to deploy the zip files on a 1.10 version of zend amf and I’ve also have the null return problem … do I have to switch zend amf to amfphp if I want real performances ? Thank you for your help.
    Cordially

    Antoine

  16. February 5th, 2010 at 14:48 | #16

    There is a new patch coming this weekend when I get done with the J.O.B. this week. We will have the performance patch into the next mini release.

  17. averger
    February 8th, 2010 at 08:54 | #17

    Thank you very much for your answer … Where will we find your mini-release in the next days ?!

  18. averger
    February 15th, 2010 at 05:56 | #18

    Hi Wade,
    your performance patch for Zend AMF is a decision criteria in my working project to make a choice between keeping ZendAMF and patch it or switch my project to AMFPhP. I’m aware of the fact that you must have a lot of other activities but your answer for the date of the next release is very important for my technical choices …

    Cordially.

    Antoine

  19. averger
    February 24th, 2010 at 03:48 | #19

    Hi,
    on February 5th, you talked about a performance improvment patch on the next mini release of Zend but on the 1.10.1 no scent of this patch … I’ve no other way to switch to AMFPhP solution … I really regret choosing ZendAMF for an important enterprise solution because I didn’t realize that the performance were so bad …

  1. January 18th, 2010 at 14:57 | #1
  2. January 19th, 2010 at 17:28 | #2