【问题标题】:Apache Camel FTP- Consumption from FTP slows down on increasing the number of files, while the total size of files remain sameApache Camel FTP - 来自 FTP 的消耗随着文件数量的增加而减慢,而文件的总大小保持不变
【发布时间】:2015-10-01 19:07:14
【问题描述】:

我是骆驼的新手。我正在尝试从安全的 ftp 服务器消费到我的本地文件夹,但消费速度真的很慢。

请建议可能有助于调整性能的参数。

我的路线如下——

ftps://ftpuser@192.168.164.130:21/files/100kbFiles?connectTimeout=60000&ftpClient.keyStore.file=.%2Fsrc%2Ftest%2Fresources%2Fwip.jks&ftpClient.keyStore.keyPassword=xxxxxx&ftpClient.keyStore.password=xxxxxx&localWorkDirectory=%2Ftmp&maximumReconnectAttempts=3&move=.done&passiveMode=true&password=xxxxxx&securityProtocol=SSL&soTimeout=60000]

到端点 - file://target/toFolder

消耗 200 个大小为 200KB 的文件大约需要 16 分钟。

我也尝试过使用流缓存——

context.getStreamCachingStrategy().setSpoolDirectory("/tmp/cachedir");
                           context.getStreamCachingStrategy().setSpoolThreshold(1024 * 102);
                           context.getStreamCachingStrategy().setBufferSize(1024 * 1024 );

从端点 ->

ftps://ftpuser@192.168.164.130:21/files/100kbFiles?connectTimeout=60000&delay=3000&eagerMaxMessagesPerPoll=true&ftpClient.keyStore.file=.%2Fsrc%2Ftest%2Fresources%2Fwip.jks&ftpClient.keyStore.keyPassword=xxxxxx&ftpClient.keyStore.password=xxxxxx&maxMessagesPerPoll=200&maximumReconnectAttempts=3&move=.done&passiveMode=true&password=xxxxxx&securityProtocol=SSL&soTimeout=60000]

到端点 -> file://target/toFolder 消耗 200 个大小为 100kB 的文件也需要将近 15 分钟......

当我使用相同的路径来消耗 20 个大小为 1 MB 的文件时,只需要 1 分 30 秒。

我无法理解为什么当批量增加时骆驼会变慢。

请建议,我缺少哪些参数可以提高 FTPS 的性能。

我正在使用骆驼 2.15.2,Commons net API 3.3。

谢谢,

【问题讨论】:

    标签: apache-camel apache-commons-net camel-ftp


    【解决方案1】:

    想到的一个问题是在camel-ftp组件站点http://people.apache.org/~dkulp/camel/ftp2.html上,它说

    FTP 消费者不支持并发 FTP 消费者(带有 相同的端点)不支持并发(支持 FTP 客户端是 不是线程安全的)。您可以使用多个 FTP 使用者进行轮询 不同的端点。它只是一个单一的端点,不 支持并发消费者。

    FTP生产者没有这个问题,它支持并发。

    要检查,为什么不使用 100KB 大小的文件,但首先尝试使用 1 个文件,然后是 10,然后是 25,然后是 50,然后是 100、125、150 和 200,看看从什么点开始需要太长时间。

    在那之后,我会考虑使用批处理消费者,看看它是否可以帮助加快购买轮询多个文件的速度。你可以在这里找到信息: http://camel.apache.org/batch-consumer.html 与camel-ftp 和 How Camel 2.11 batch aggregation works with separate route?

    【讨论】:

    • 感谢您对这个问题的回复......我在上面的代码中使用了批处理消费者和流缓存,请参阅“maxmessageperpoll=200”。我用少量文件分析了它在 50 秒内消耗 10 个文件,并始终保持每个文件 5 秒的速度。
    猜你喜欢
    • 1970-01-01
    • 2021-04-12
    • 1970-01-01
    • 2021-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-09
    • 1970-01-01
    相关资源
    最近更新 更多