Xmlport performance problem

RMarcRMarc Member Posts: 36
edited 2011-03-31 in NAV Three Tier
Hi and happy new year for all!! :D

I have a performance problem with a import xmlport and i dont understand why... My XMLport import a TXT file with lines of sales invoices. The file, usually have 1880 lines.

The code in the xmlport evaluate imported elements and generate new sales invoice in Dynamics NAV 2009 SP1. The xmlport not perform complex business logic, but for example, will cost approximately 10 minutes to process 50 records...
The extrange thing is i have a dataport with the same code in the same SQL database and this is very fast.

The code to run the xmlport is:

CLEAR(ImportXMLPort);
ImportXMLPort.GetParameters(var1,var2);
FileIn.OPEN(InvHdrTxt);
FileIn.CREATEINSTREAM(StreamIn);
ImportXMLPort.SETSOURCE(StreamIn);
ImportXMLPort.IMPORT;
FileIn.CLOSE();


Anyone have any idea who can help me, please?

Thanks in advance!!!

Answers

  • jlandeenjlandeen Member Posts: 524
    Have you tried modifying the XML Port so that it only reads the data (and does not do any updates) so that you can see if the issue is with the reading of XML file or processing of the data?

    1880 records doesn't sound like it should take that long to process and there could be a problem with the XML Parser or something else. How big is the data file that you are trying to import? I've seen NAV struggle with files over 200Mb in size.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • RMarcRMarc Member Posts: 36
    jlandeen wrote:
    Have you tried modifying the XML Port so that it only reads the data (and does not do any updates) so that you can see if the issue is with the reading of XML file or processing of the data?

    1880 records doesn't sound like it should take that long to process and there could be a problem with the XML Parser or something else. How big is the data file that you are trying to import? I've seen NAV struggle with files over 200Mb in size.

    Hi jlandeen, and thanks for your reply.

    The files that i'm trying to import ara between 200 and 300 Kb, I don't think the files are very big...

    I'll try what you've said me and see if the problem really is in updating data or is in XMLPort's reading.

    Thanks a lot!
  • jlandeenjlandeen Member Posts: 524
    Yes 200 to 300Kb really doesn't sound like a large file size. I definately think your next step is to break apart the XML file processing and parsing from the actual DB processes of write/read/modify/delete so that you can see where the performance is breaking down. Typically I've found NAV to be pretty good at reading and processing XML files.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • RMarcRMarc Member Posts: 36
    Hi jlandeen,

    Thnaks very much for your reply, and sorry for the delay in my reply.

    Finally, is sure that the problem isn't the file, because i've tested XMLPort with a file with a single row and also slows down the system.

    At this point, I decided to comment the code that was on the trigger OnBeforeInsertRecord and reading of data has been very rapid. This means that the problem is in the code of the trigger.

    After analyzing the code, I noticed that the problem appears in the following statement:
    SalesHeader.VALIDATE("Sell-to Customer No.",Cust."No.");

    If I change the statement to assign the value without making VALIDATE, the behavior is fast.... ](*,)

    Any idea??
    Thanks a lot!
  • jlandeenjlandeen Member Posts: 524
    Depending on any custom logic (and even base logic) validation on the Customer No. field in a sales order can trigger a whole lot of logic. Typically there will be updates to the shipping address, company address, tax location and other values on the header of the record.

    I find in a lot of implementations there is also conditional logic to perform custom checks and update other values and tables when a new order is created or assigned to a customer. What happens when this action is performed by a user when inserting a new sales order? Does it take a long time for the system to respond and update the header information?
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • RMarcRMarc Member Posts: 36
    The system creates sales invoices, so business logic that runs is less than when you insert a sales order.

    What I find curious is that when a user inserts a new sales invoice, the system is very flexible, and this process is running with Dataports, and is pretty fast.

    However, thanks to your comment, I tried to post some of the code, specific to this database, and that's the problem.
    I do not understand because it is only slow when the call is made ​​from a XMLport, but honestly, all the invoices that are loaded through this system, do not need this part of the code, so I resolved the case on! \:D/ \:D/

    Thank you very much for everything jlandeen!!!!
  • jlandeenjlandeen Member Posts: 524
    Glad to hear that you were able to sort it out!

    You should flag this post as solved with the little green check mark too - I think they like when that happens on here ;)
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • RMarcRMarc Member Posts: 36
    Hi jlandeen

    Sorry but.... How i flag this post as solved? Where is the green check mark... ? #-o #-o

    Thanks!!
  • SogSog Member Posts: 1,023
    You can search miboso for how to do that :), but quickly
    Modify your first post and you'll have a extra option near your subject. Attribute I think.
    Set the attribute to solved and submit.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • RMarcRMarc Member Posts: 36
    Sog wrote:
    You can search miboso for how to do that :), but quickly
    Modify your first post and you'll have a extra option near your subject. Attribute I think.
    Set the attribute to solved and submit.

    Thanks Sog, Post edited and solved!!! =D>
Sign In or Register to comment.