Pros and Cons of setting Lot of headers in Camel Exchange

♀尐吖头ヾ 提交于 2019-12-13 00:15:03

问题


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?

回答1:


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.



来源:https://stackoverflow.com/questions/30438269/pros-and-cons-of-setting-lot-of-headers-in-camel-exchange

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!