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

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

问题描述

我想知道一些关于 Camel Headers 的事情

I would like to know few things about Camel Headers

  1. 在camel Exchange 中设置太多标头的利弊是什么?
  2. 在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.

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

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.

就其本身而言,大标题不一定会导致任何问题.出现的问题出现在有多个交换的系统中,每个交换都有单独的大对象需要操作.将所有这些东西保存在内存中对系统来说是一种负担,但这并不是因为 Camel 的任何不足.

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.

也就是说,拥有真正大的标题是非典型的.通常,如果您需要在 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天全站免登陆