将文件从旧的专用服务器传输到新的专用服务器
使用经典 ASP(停止吐槽),我需要构建一个应用程序,将高分辨率照片从一台服务器传输到另一台服务器,准确地说,包括缩略图在内,大约有 360,000 张照片。该应用程序将通过 Windows 计划调用,并将作为后台进程运行。
在考虑性能的情况下,实现这一目标的最佳方法是什么?上次我构建这样的怪物脚本时,正在传输和转换超过一百万行的数据库表,应用程序启动得非常快,但在 25,000 条记录之后,它变得非常非常慢!所以我想避免这种情况。
显然这将是跨域传输,所以我正在考虑使用 ASP/FTP 组件,并逐一抓取文件,发送它,并将其成功记录在数据库表中,以便它知道有什么到目前为止已完成。
最好一次处理一个文件并刷新,这样就不会滥用服务器的资源,还是应该一次处理 1000 个或更多?我希望它尽可能快,但又不会阻塞服务器。
任何帮助/建议将不胜感激。
Using Classic ASP (stop tutting), I need to build an application that transfers high resolution photos from one server to another, around 360,000 including the thumbnails to be exact. The application will be called via a Windows schedule and will run as a background process.
What is the best way to achieve this, keeping performance in-mind? The last time I built a monster script like this was transferring and converting database tables for over one million rows, the application started really fast, but then after 25,000 records it went really, really slow! So I want to avoid this.
Obviously it will be a cross-domain transfer, so I was thinking about using an ASP/FTP component, and one-by-one, grab a file, send it, and record its success in a DB table so it knows what is has done so far.
Is it best to process one file at a time and refresh, so it doesn't abuse the server's resources, or should I process 1000 at a time, or more? I want it to be as quick as possible but without clogging up the server.
Any help/suggestions would be gratefully received.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为最好一次处理一个文件,因为如果连接短时间内中断,您不会丢失已发送的文件。
即使您使用 ASP Classic,您也可以利用 .net 中的 FTP 客户端类上传文件,并避免购买/安装第三方组件。当然.net已经安装在服务器上。
我的过程将如下所示:
如果过程是如果服务器堵塞,您可以在每次上传之间短暂暂停。
I think is best to do one file at a time because if the connection goes down for a brief period of time you don't lost the files that you have already sent.
Even when you are using ASP Classic you can take advantage of .net for uploading the files using the FTP client classes in .net and avoid purchasing/installing a third party component. Surely .net is already installed on the server.
My process will look like this:
If the process is clogging the server, you can put a brief pause between each upload.
我有类似的东西在经典 ASP 中运行,它可以毫无问题地处理数以万计的图像。
在容纳图像的服务器上,我运行一个(vbs)脚本,该脚本为每个图像
脚本连续运行并且仅检查每个文件夹和文件(如果文件存在于网络服务器上),如果没有创建它们,则不需要数据库。
在每次检查之间它会休眠一秒钟。这样服务器的负载只有2%。我在命令行方式中使用 iPhoto 来提取元数据和图像,但您可以使用库来提取元数据和图像。
因此,这三个文件以来自第一个服务器的地图结构的副本存储在网络服务器上,但没有全尺寸图像。
在网络服务器上,您只需要能够浏览缩略图并可视化元数据和中型图像。
如果用户需要全尺寸图像,他可以单击中等尺寸的图像,该图像的 url 为第一台服务器上的文件。
i have something like that running in Classic ASP, it handles tenthousands of images without problem.
On the server that houses the images I run a (vbs)script that for each image
The script runs continuously and only checks per folder and file if the files are present on the webserver and if not creates them, No need for a DB.
Between every check It sleeps a second. Like that the load on the server is only 2%. I use iPhoto in command-line modus to extract the metadata and images but you could use a library for that.
So these three files are stored on the webserver in a copy of the mapstructure from the first server but without de full-sized images.
On the webserver you only need to be able to browse the thumbnails and visualize the metadata and mid-size images.
If the user needs the full-size image he clicks the mid-sized which has as url the file on the first server.
超过 360,000 个单独事务的网络握手量将成为瓶颈。
The amount of network handshake over 360,000 individual transactions would be the bottleneck.