Method Community

 

performance of MethodWebAPI vs Method Action

Last post 05-07-2015 4:11 PM by Method_Jonathan. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 05-04-2015 7:53 PM

    performance of MethodWebAPI vs Method Action

    Hi Method,

    Not sure if my question is ok in this forum or in General Q&A, I put it here first since it is about WebAPI.


    1. In my Purchase Order Screen, when I insert an POLineItem, I customize its behavior, so it will insert two extra records to my other tables in addition to new record to PurchaseOrderLine. (That is, there are three "Insert record to table" actions been executed.) 

    2. Since the way done in (1) is very slow, it took about 2 - 4 seconds to make it. (I tested it by insert 10 items in a loop.) So, we are thinking if we can get some performance improvement if we change this part in WebAPI. So, we did it by calling MethodAPIInsertV2. And it is done in PHP with a Apache server. The result is actually even worse, every item takes 4-6 seconds, which is almost double compared to Method Action. 

    3. The same scenario done in a local VB program, performance is stil the same as PHP version, which is slow compared to Method Action.

    Just wondering if this kind of result is as expected (WebAPI insert is slower than Method Action)? If it is as expected, any way we can do to improve performance while using WebAPI? or something wrong I did to call WebAPI?

    Thanks.

    Alex

    -----

    my code in PHP

    function CreatePurchaseOrderLineItem($CompanyAccount, $Login, $Password, $SessionID, $PORecordID, $Location, $Depot, $ContainerNo, $ItemName, $ItemDescription, $UnitPrice)
    {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, "https://www.methodintegration.com/MethodAPI/service.asmx/MethodAPIInsertV2");
    curl_setopt($curl, CURLOP_POST, 1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $optparam = "strCompanyAccount=" . $CompanyAccount. "&strLogin=" . $Login . "&strPassword=" . $Password. "&strSessionID=" . $SessionID;

    $optparam .= "&strTable=PurchaseOrderLine";

    $optparam .= "&arrInsertFieldsArray=BICID&arrInsertValueArray=" . $ContainerNo;
    $optparam .= "&arrInsertFieldsArray=IEMBICID&arrInsertValueArray=" . $ContainerNo;
    $optparam .= "&arrInsertFieldsArray=Item&arrInsertValueArray=" . $ItemName;
    $optparam .= "&arrInsertFieldsArray=Desc&arrInsertValueArray=" . $ItemDescription;
    $optparam .= "&arrInsertFieldsArray=PurchaseOrderRecordID&arrInsertValueArray=" . $PORecordID;
    $optparam .= "&arrInsertFieldsArray=Quantity&arrInsertValueArray=" . "1";
    $optparam .= "&arrInsertFieldsArray=Rate&arrInsertValueArray=" . $UnitPrice;
    $optparam .= "&arrInsertFieldsArray=IEMItemDepotName&arrInsertValueArray=" . $Depot;
    $optparam .= "&arrInsertFieldsArray=IEMItemLocationName&arrInsertValueArray=" . $Location;
    $optparam .= "&arrInsertFieldsArray=IEMTransFromDepot&arrInsertValueArray=" . $Depot;
    $optparam .= "&arrInsertFieldsArray=IEMTransFromLocation&arrInsertValueArray=" . $Location;
    $optparam .= "&arrInsertFieldsArray=QBIEMDepot&arrInsertValueArray=" . $Depot;
    $optparam .= "&arrInsertFieldsArray=QBIEMLocation&arrInsertValueArray=" . $Location;

    if ($globalDebug)
    {
    echo $optparam;
    }

    curl_setopt($curl, CURLOPT_POSTFIELDS, $optparam);
    $result = curl_exec($curl);
    curl_close($curl);

    return CheckErrorAndReturnRecordID($result, -101);
    }

    Chief Architect
    Yi Systems, Inc.
    alexhuang@yisystems.com
    www.yisystems.com blogs.yisystems.com
    Software.Web.Cloud.IT
  • 05-05-2015 8:06 AM In reply to

    Re: performance of MethodWebAPI vs Method Action

    Hi Alex,

    Addressing API perofrmance is on our product roadmap for future enhancements within Method - that being said, the process of inserting a single PO line item taking 6 seconds seems high.  We were experiencing performance issues yesterday, which could have impacted time for processing ... I am assuming that you performed these tests yesterday, and if this is not the case, please let me know.

    A potential improvement that I'll have you try - Are any of your custom PO line item fields of type DropDown?  If so, you can try inserting these values using RecordIDs rather then the acutal text value for the drop down.  This should lessen the validation required by the API.

    Jonathan Gamble
    Product Manager
    Method Integration Inc.
    Local and overseas: 416.847.0400
    Toll Free: 1.888.925.6238
    Fax: 416.640.6027
    E-mail: j.gamble@method.me
  • 05-05-2015 11:05 AM In reply to

    Re: performance of MethodWebAPI vs Method Action

    Hi,

    Thanks for reply.

    For my case, to have one item line in a PO, I need to add two extra records to my own table in addition to one record in PurchaseOrderLine. (that is three table insertion.)

    I actually did the test after you post the whole system is back to normal. I did a quick test just now, it is the same. I'll find some time today to test your suggestion which is inserted by RecordID.

    So, you are saying API performance is slower than Method Action is expected? 

    --

    Alex

    Chief Architect
    Yi Systems, Inc.
    alexhuang@yisystems.com
    www.yisystems.com blogs.yisystems.com
    Software.Web.Cloud.IT
  • 05-06-2015 10:12 AM In reply to

    Re: performance of MethodWebAPI vs Method Action

    Hi,

    I did a quick test to use RecordID to insert dropdown-type field. In WebAPI or Method-Action, seems no big difference.

    Still, my question is:

    Is it true that WebAPI is slower than Method-Action regarding "Insert record to table"? I need to know this so I don't do database operations in my PHP.

    Thanks.

    Alex

    Chief Architect
    Yi Systems, Inc.
    alexhuang@yisystems.com
    www.yisystems.com blogs.yisystems.com
    Software.Web.Cloud.IT
  • 05-06-2015 4:24 PM In reply to

    Re: performance of MethodWebAPI vs Method Action

    Answer

    Hi Alex,

    In this case, yes, you will see better performance from the method action.

    The variance in processing time between the Method action set and API version of your example is due to the fact the API requires you to make a separate server call for each insert.  The Method action set is faster in this case because the entire Method action set is sent to the server for processing in a single call.  

    Jonathan Gamble
    Product Manager
    Method Integration Inc.
    Local and overseas: 416.847.0400
    Toll Free: 1.888.925.6238
    Fax: 416.640.6027
    E-mail: j.gamble@method.me
  • 05-07-2015 3:03 PM In reply to

    Re: performance of MethodWebAPI vs Method Action

    Joanthan

    Can you describe how to specify a dropdown's recordid instead of the value when inserting a new record through API.  I've tried to set the value of the field ###_RecordID but get a reponse that this field doesn't support "edit".   What should we use as the field name to set the recordid?

    Mark Crews
    Cloud Consultancy
    Principal and Developer


    • 2012 MethodCRM Partner of the Year

    • 2012 MethodCRM Community Excellence Award

    • 2011 MethodCRM Community Excellence Award


    Visit our website to find out about our training, support, and customization services.
    website: cloudconsultancyllc.com
    blog: cloudconsultancyllc.com/blog/
    ph: 434.326.1601
    e: support@cloudconsultancyllc.com

    What is Method?
  • 05-07-2015 4:11 PM In reply to

    Re: performance of MethodWebAPI vs Method Action

    Hi LaCrews,

    Ok - Are you successful if you insert into the Field name directly?  I'll have to followup on further on my end to verify this feature.

    Jonathan Gamble
    Product Manager
    Method Integration Inc.
    Local and overseas: 416.847.0400
    Toll Free: 1.888.925.6238
    Fax: 416.640.6027
    E-mail: j.gamble@method.me
Page 1 of 1 (7 items)