java camel exchange类,在Camel Exchange中设置很多标题的利弊

I would like to know few things about Camel Headers

what are the pros and cons of setting too many headers in camel Exchange?

what are the pros and cons of setting too large headers in camel Exchange?

解决方案

If you have too many or too large, then by definition there will be problems. But let's consider simply many and large instead.

Many Headers

The headers in Camel are held in a java.util.TreeMap, so there may be some performance characteristics to consider with this data structure. Perhaps there may be an issue if many headers are added all at once in their natural order, as the tree would need to rebalance several times. Also, keep in mind that searching for a specific header would be a O(log n) operation, so there could be efficiency issues if multiple queries of specific headers occur.

Large Headers

By themselves, large headers don't necessarily cause any problems. The issues which arise are in systems where there are several exchanges, each with separate large object needing to be manipulated. It's taxing on the system to hold all these things in memory, but not because of any deficiency of Camel.

That said, it would be atypical to have truly large headers. Typically, if you need to process large objects in Camel, it is better to have them as streams in the body of the message.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值