Recently at one of our client sites, we were troubleshooting a slowness issue in the application, which occurs only on weekends. System is working normally during weekdays. Different components of systems were checked and it all came out clean. So we decided to perform basic ftp test on good day vs. bad day. If time taken is more on bad day compared to the timing on good day then we know for sure that there is problem somewhere either on the machines involved and/or in the network between them. This is not the true test to identify the slowness as application might be communicating on the port other than the ftp port but it will give us some idea in general.
Now to perform ftp from one machine to another and vice versa we need a physical file of some size and hence need the disk storage as well. But IBM support person working with us suggested a very good approach to ftp data without involving a file and as result without involving any disk storage. Following is the basic syntax of the put command once we establish the ftp session with remote server.
put “|dd if=/dev/zero bs=32k count=1000” /dev/null
In above syntax, we are using dd command to transfer the 1000 blocks of data with each data block of 32k and we are using /dev/zero as input and /dev/null as output. Using this syntax we can transfer large file without involving disk. We can put it even in a shell script and then schedule the shell script as cron job to run at regular interval. Following is the shell script wrapped around the command.
/usr/bin/ftp -n <IP address of machine> <<END
user <userID> <Password>
put “|dd if=/dev/zero bs=32k count=10000” /dev/null
Copy above lines into the file and save it as a .sh file. Please make sure to change the values in the <> brackets with correct IP address of the machine you want to perform ftp to. Also change the user line (line# 3) with appropriate user credentials. You will save this file and execute it on the machine from which you want to perform ftp.
Obviously this is not the route we took immediately after facing the issue. We resorted to ftp option after exhaustive checking of application and database and not finding anything suspicious. We performed above test on AIX servers. To know more about dd command, please refer to AIX manual pages (man dd) on any of the AIX servers in your environment.
- IBM Article – here.