如何从 Hudson CI API 获得更好的性能?
我正在尝试为自己编写一个与 Hudson 构建服务器集成的小工具。我目前遇到的障碍是性能。我想做一件简单的事情,比如列出所有作业和上次成功构建的时间。 Hudson API 提供了此信息,但我要么必须查询 深度=2
处的所有内容,要么单独查询每个作业(当前有 150 个作业)。即使使用 exclude
,任何一种方法都需要半分钟以上的时间。这对于一个应该是活泼的 UI 来说是不可接受的。我需要这个时间低于 1 秒,最好低于 0.5 秒。
我目前提出的解决方案是在客户端进行一些大量的缓存。构建数据不会改变,因此事情变得更加容易。但这仍然需要大量编码。
是否有另一种方法可以快速获取此信息?也许有一个插件可以缓存所有数据并提高 API 速度?请注意,该工具通常无法访问 HUDSON_HOME。
I'm trying to write a little tool for myself that would integrate with Hudson build server. The current roadblock that I've hit is performance. I'd like to do a simple thing like have a list of all jobs and the times of last successful build. The hudson API provides this information, but I either have to query everything at depth=2
or query each job individually (there's 150 of them currently). Even with exclude
either approach takes over half a minute. This is unacceptable for a UI that should be snappy. I'd need this time to be below 1s, preferably below 0.5s.
The current solution that I've come up with is doing some heavy caching on client side. Build data doesn't change, so that makes things a lot easier. But it's still a lot of coding.
Is there perhaps another way to fetch this info quickly? Perhaps there is a plugin which caches all data and enhances API speed? Note that the tool will normally NOT have access to HUDSON_HOME.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
tree
查询参数比在深度=2
查询快得多。根据 Hudson 内置 API 文档(请参阅 http:// 下的控制获取的数据量 hudson/api/),tree
比exclusion更高效,因为服务器不会生成然后丢弃数据。我认为以下 URL 适用于您问题中的查询:
在我的系统上有 40 个左右的作业:
Using the
tree
query parameter is much, much faster than querying atdepth=2
. According to the Hudson built-in API documentation (see Controlling the amount of data you fetch under http://hudson/api/),tree
is more efficient than exclude because the server doesn't generate and then discard data.I think the following URL will work for the query in your question:
On my system with 40-ish jobs: