I have a Web server (Local) and File server(Remote).

I need to create a duplicate of an xml file in the same location with different file name in the File server. The size of the file is random, but the maximum file size can be 45mb, and I have 200 users a day. I'll be using ftp_put in transferring files between server. Which is faster and efficient way between the two below?

a. Upload file to local -> Upload the file to remote with new name

b. Read the contents of the remote file and save it to variable -> Create a new file with the contents from the variable in local -> Upload the file to remote with new name

I'm not sure how I can benchmark this,so performance wise which is better a or b,why?

  • use a database instead? – Ewan Aug 24 '18 at 8:30
  • @Ewan do you mean use database to store the contents of the xml file? I'm not going to use the contents of the xml file for any future process. But how is that going to help the performance? Thanks – threeFatCat Aug 24 '18 at 8:46
  • So if you are just copying the file its hard to do anything with performance, it is what it is. But if you can take a different approach and build each file at the same time you have more options – Ewan Aug 24 '18 at 10:12
  • Benchmarking should be easy: start a timer before the operation begins, stop the timer when the operation is done, calculate the time difference and put the result somewhere (for example, in a log file). But in theory, both of your suggested ways transfer the file two times over the network, from remote to local and back, so I would not be astonished if it turns out both ways give you similar results. – Doc Brown Aug 24 '18 at 14:55
  • @Ewan building each file at the same time is more convenient, but unfortunately the XML is actually a PDF schema which is an input file from the user and will be later used for producing actual pdf file. We have tool a and b (receives the XML from web), tool a is the one that reads the XML file to produce PDF, while tool b will be needing also the XML for another output but this tool is configured to check specific file name format inside a folder. We can't change tool b since it's basically used by other processes and it will be more costly adjustment. – threeFatCat Aug 27 '18 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.