How to get the best performance from the Hudson CI API?

I am trying to write a small tool for myself that integrates with the Hudson build server. The current roadblock I hit is performance. I would like to do a simple thing, such as a list of all tasks and the time of the last successful build. The hudson API provides this information, but I need to either request everything in depth=2 , or request each task individually (there are 150 of them currently). Even with exclude any approach takes half a minute. This is not acceptable for a user interface that should be fast. I need this time to be below 1 s, preferably below 0.5 s.

In the current solution I came up with, there is heavy caching on the client side. Assembly data does not change, so this simplifies the work. But this is still a lot of coding.

Is there any other way to get this information quickly? Perhaps there is a plugin that caches all data and improves the speed of the API? Note that a tool will usually not have access to HUDSON_HOME.

+2
source share
1 answer

Using the tree query parameter is much faster than the depth=2 query. According to the documentation on the Hudson built-in APIs (see "Managing the amount of data that you select at http: // hudson / api / ), tree more efficient than excluding it because the server does not generate or discard data.

I think the following URL will work for the request in your question:

 http://hudson/api/xml?tree=jobs[name,lastSuccessfulBuild[number,url,timestamp]] 

On my system with 40 other jobs:

 $ time curl "http://hudson/api/xml?tree=jobs\[name,lastSuccessfulBuild\[number,url,timestamp\]\]" <hudson><job><name>Example Windows build</name> <lastSuccessfulBuild><number>7</number> <timestamp>1264806194000</timestamp> ...lots of unformatted XML... real 0m0.166s user 0m0.062s sys 0m0.093s 
+3
source

Source: https://habr.com/ru/post/1396661/


All Articles