Home > Back-end > Being FTP file to read and check
Being FTP file to read and check
Time:10-13
Is there such a demand: 1. The data in the database has more than ten million, more than a table after the query will get files on the FTP service storage paths, 2. Now you need to check through the storage path on the FTP file does not exist, if the file exists, then need to determine whether a file damage depending on the type of file Now, ten million data circulating flow request access to the file on the FTP, next reoccupy calibration method, finish for each loop flow check again need to 2 seconds, if single thread ran a couple of months, a multi-threaded run and will be out of memory, even reduce the thread, to avoid memory leaks, will continue to run a few days, and the number of connections limits FTP service, can only use the URL for the file stream, but ran after a period of time, the URL access to flow more slowly, don't know if you have good ideas, can greatly improve the efficiency of
//ftp://URL the URL=new URL (new String (fullPath. GetBytes (" GBK "), "GB2312")); URLConnection con=url. The openConnection (); InputStream=con. GetInputStream ();
CodePudding user response:
Run check on FTP file server, the result is submitted to a file or database
CodePudding user response:
File check use what way? Check if the file down down, will be a waste of time, because most of the time spent in the download process, The general idea is as follows: 1, FPT file on the server has its own hash check values to visit 2, the records in the database have corresponding hash available 3, not the file download, but the hash value to directly compare the two