I am having issues with the Jira API. The code I have below works for the public Altassian Jira. If I change the $versions, $options, and $urls specifically for my Jira installation, then I end up getting a maximum of only 10 successful responses.
For my Jira installation:
- I change $versions to be specific to my installation
- I change $options to use port 80 and to use an 'Authentication: Basic ...' header
- I change $urls to use my installations url and to use http instead of https
My questions are:
- Is there a setting for Apache that limits the number of concurrent basic authentication requests for each user?
- Is there a setting for Jira that limits the number of concurrent API requests for each client?
Any help is appreciated.
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>ghi</title> </head> <body> <?php $versions = array( "JRA" => array("6.1","6.0","5.2","5.0","4.4","4.3"), ); $jqls = array( "one" => "project='%s' AND fixVersion='%s'", "two" => "project='%s' AND fixVersion='%s'", "three" => "project='%s' AND fixVersion='%s'", "four" => "project='%s' AND fixVersion='%s'", "five" => "project='%s' AND fixVersion='%s'", "six" => "project='%s' AND fixVersion='%s'", "seven" => "project='%s' AND fixVersion='%s'", "eight" => "project='%s' AND fixVersion='%s'", "nine" => "project='%s' AND fixVersion='%s'" ); $options = array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_PORT => 443, CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ) ); foreach ($versions['JRA'] as $ver) { foreach ($jqls as $id => $query) { $urls[$ver][$id] = 'https://jira.atlassian.com/rest/api/latest/search?startAt=0&maxResults=0&jql=' . rawurlencode(sprintf($query, 'JRA', $ver)); } } set_time_limit(0); echo "<pre>"; foreach ($urls as $ver => $group) { foreach ($group as $id => $u) { $ch = curl_init($u); curl_setopt_array($ch, $options); $curls[$ver][$id] = $ch; } } $mh = curl_multi_init(); foreach ($curls as $ver => $group) { foreach ($group as $id => $ch) { curl_multi_add_handle($mh, $ch); } } $running = null; $failures = 0; do { $mrc = curl_multi_exec($mh, $running); $info = curl_multi_info_read($mh); if (false !== $info && $info['result'] != 0) { $failures++; } } while ($running > 0); echo 'failed requests: ' . $failures . "\n\n"; foreach ($curls as $ver => $group) { foreach ($group as $id => $ch) { $resp = json_decode(curl_multi_getcontent($ch)); if (gettype($resp) == 'object') { $results[$ver][$id] = $resp->total; } else { $results[$ver][$id] = gettype($resp); } curl_multi_remove_handle($mh, $ch); } } curl_multi_close($mh); print_r($results); print_r($urls); echo "</pre>"; ?> </body> </html>
Hello,
I am not aware of any limit in Jira or apache by default. So its probably a module installed in their Apache.
Here, we actually have a QOS in place on our Jira instance because we had user that were spammimg it.
We installed mod_QOS a module for apache : http://opensource.adnovum.ch/mod_qos/
before installing this, we could hit up to 80/sec by 1 ip of requests easily which was spamming our server. We limited it at 3/sec
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.