我们有一个代理从JMS队列中获取消息并将它们发送到FTP文件夹。我们现在发现,当FTP上的目标目录已经包含大量文件时,发送到FTP的速度非常慢。 (即当我有一个目录在2000年左右的文件,它已经花费几秒钟)为什么FTP发送取决于其目录大小?
这里我们代理的代码(从JMS获得消息(纯文本),并将其写入FTP):
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="myProxy" statistics="disable" trace="disable" transports="jms">
<parameter name="transport.jms.Destination">myQueue</parameter>
<parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>
<parameter name="transport.jms.DestinationType">queue</parameter>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>text/plain</default>
</rules>
</parameter>
<target faultSequence="rollbackSequence">
<inSequence>
<log level="custom">
<property name="STATUS" value="myProxy called"/>
</log>
<property name="ClientApiNonBlocking" scope="axis2" action="remove"/>
<property name="OUT_ONLY" value="true"/>
<property name="transport.vfs.ReplyFileName" expression="fn:concat(get-property('SYSTEM_DATE','yyyyMMddHHmmss_SSS'), '_result.txt')" scope="transport"/>
<send>
<endpoint key="myFTPendpoint"/>
</send>
</inSequence>
</target>
而且FTPEndpoint lookes这样的:对于
<?xml version="1.0" encoding="UTF-8"?>
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="myFTPendpoint">
<address uri="vfs:ftp://USER:[email protected]/path/toSomewhere?vfs.passive=true"/>
</endpoint>
我现在的分析:
- 在VFS中使用FTP时速度很慢。使用本地文件系统时 - 速度很快。
- 文件是微小的 - 所以它不是上传时间
- 网络是快速
- 速度在目录中已经依赖于文件的数量上的FTP!
可能的解决方案?
- 修复了速度问题。禁用目录列表?
- Workaraound:在输出创建新的文件夹(即不是一个文件夹被涂抹太多)
是否有人还发现了同样的问题?如何改进大目录的FTP速度? 感谢您的任何帮助
好像每次发送消息时都会创建与FTP的连接。有没有可能改善这种表现?持久连接到FTP? – FiveO 2012-08-28 09:42:22
我们发现速度取决于位于FTP目录中的文件数量!哇 - 似乎发送到FTP总是使所有文件ls。 – FiveO 2012-09-27 06:52:14