在Camel Exchange中设置很多标题的利弊 [英] Pros and Cons of setting Lot of headers in Camel Exchange

查看:84
本文介绍了在Camel Exchange中设置很多标题的利弊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解关于骆驼头的几件事

  1. 在骆驼Exchange中设置太多标头的利弊是什么?
  2. 在camel Exchange中设置太大的标题有什么利弊?

解决方案

如果太多太大,那么根据定义,就会有问题.但是让我们考虑简单地很多.

许多标题

Camel中的标头保存在java.util.TreeMap中,因此使用此数据结构可能需要考虑一些性能特征.如果同时以自然顺序一次添加许多标头,则可能会出现问题,因为树将需要重新平衡几次.另外,请记住,搜索特定标头将是 O(log n )操作,因此,如果发生多个对特定标头的查询,可能会带来效率问题./p>

大标题

大页眉本身并不一定会引起任何问题.出现的问题是在有多个交换的系统中,每个交换都有单独的大对象需要操作.将所有这些内容存储在内存中是对系统的一种负担,但这并不是因为Camel的任何不足.

也就是说,拥有真正大的标题是不典型的.通常,如果您需要使用Camel处理大型对象,最好将它们作为流放在邮件正文中.

I would like to know few things about Camel Headers

  1. what are the pros and cons of setting too many headers in camel Exchange?
  2. 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.

这篇关于在Camel Exchange中设置很多标题的利弊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆