summaryrefslogtreecommitdiff
path: root/indra/llcorehttp
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2013-07-08 20:31:09 +0000
committerMonty Brandenberg <monty@lindenlab.com>2013-07-08 20:31:09 +0000
commitfb734d621e6fa2004d191849783e81da75992d06 (patch)
tree3e94ea39ccd541c2c01adbb989b22d674566acee /indra/llcorehttp
parent10f9264f7b25dcd8591c965e8af83e0d9c260636 (diff)
Found the memory corruptor. String trimmer didn't have a valid
termination test. Sheesh. Also get some more numbers out of the example/load test program which drives traffic. This should give some useful insights into how the current http throttle works (or doesn't) with varying client demands.
Diffstat (limited to 'indra/llcorehttp')
-rwxr-xr-xindra/llcorehttp/_httpoprequest.cpp4
-rwxr-xr-xindra/llcorehttp/examples/http_texture_load.cpp36
2 files changed, 35 insertions, 5 deletions
diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp
index 8cb7fee701..ce0fc605ab 100755
--- a/indra/llcorehttp/_httpoprequest.cpp
+++ b/indra/llcorehttp/_httpoprequest.cpp
@@ -1025,13 +1025,15 @@ char * os_strtrim(char * lstr)
}
if (*lstr)
{
- for (char * rstr(lstr + strlen(lstr)); *--rstr;)
+ char * rstr(lstr + strlen(lstr));
+ while (lstr < rstr && *--rstr)
{
if (' ' == *rstr || '\t' == *rstr)
{
*rstr = '\0';
}
}
+ llassert(lstr <= rstr);
}
return lstr;
}
diff --git a/indra/llcorehttp/examples/http_texture_load.cpp b/indra/llcorehttp/examples/http_texture_load.cpp
index 119e34f7ec..88c8102b27 100755
--- a/indra/llcorehttp/examples/http_texture_load.cpp
+++ b/indra/llcorehttp/examples/http_texture_load.cpp
@@ -58,6 +58,7 @@ void usage(std::ostream & out);
// Default command line settings
static int concurrency_limit(40);
+static int highwater(100);
static char url_format[1024] = "http://example.com/some/path?texture_id=%s.texture";
#if defined(WIN32)
@@ -113,6 +114,8 @@ public:
int mErrorsHttp416;
int mErrorsHttp500;
int mErrorsHttp503;
+ int mRetries;
+ int mRetriesHttp503;
int mSuccesses;
long mByteCount;
LLCore::HttpHeaders * mHeaders;
@@ -160,7 +163,7 @@ int main(int argc, char** argv)
bool do_verbose(false);
int option(-1);
- while (-1 != (option = getopt(argc, argv, "u:c:h?Rv")))
+ while (-1 != (option = getopt(argc, argv, "u:c:h?RvH:")))
{
switch (option)
{
@@ -184,6 +187,21 @@ int main(int argc, char** argv)
}
break;
+ case 'H':
+ {
+ unsigned long value;
+ char * end;
+
+ value = strtoul(optarg, &end, 10);
+ if (value < 1 || value > 100 || *end != '\0')
+ {
+ usage(std::cerr);
+ return 1;
+ }
+ highwater = value;
+ }
+ break;
+
case 'R':
do_random = true;
break;
@@ -239,7 +257,7 @@ int main(int argc, char** argv)
ws.loadAssetUuids(uuids);
ws.mRandomRange = do_random;
ws.mVerbose = do_verbose;
- ws.mRequestHighWater = 100;
+ ws.mRequestHighWater = highwater;
ws.mRequestLowWater = ws.mRequestHighWater / 2;
if (! ws.mAssets.size())
@@ -273,6 +291,8 @@ int main(int argc, char** argv)
std::cout << "HTTP 404 errors: " << ws.mErrorsHttp404 << " HTTP 416 errors: " << ws.mErrorsHttp416
<< " HTTP 500 errors: " << ws.mErrorsHttp500 << " HTTP 503 errors: " << ws.mErrorsHttp503
<< std::endl;
+ std::cout << "Retries: " << ws.mRetries << " Retries on 503: " << ws.mRetriesHttp503
+ << std::endl;
std::cout << "User CPU: " << (metrics.mEndUTime - metrics.mStartUTime)
<< " uS System CPU: " << (metrics.mEndSTime - metrics.mStartSTime)
<< " uS Wall Time: " << (metrics.mEndWallTime - metrics.mStartWallTime)
@@ -310,8 +330,10 @@ void usage(std::ostream & out)
" -u <url_format> printf-style format string for URL generation\n"
" Default: " << url_format << "\n"
" -R Issue GETs with random Range: headers\n"
- " -c <limit> Maximum request concurrency. Range: [1..100]\n"
+ " -c <limit> Maximum connection concurrency. Range: [1..100]\n"
" Default: " << concurrency_limit << "\n"
+ " -H <limit> HTTP request highwater (requests fed to llcorehttp).\n"
+ " Range: [1..100] Default: " << highwater << "\n"
" -v Verbose mode. Issue some chatter while running\n"
" -h print this help\n"
"\n"
@@ -332,6 +354,8 @@ WorkingSet::WorkingSet()
mErrorsHttp416(0),
mErrorsHttp500(0),
mErrorsHttp503(0),
+ mRetries(0),
+ mRetriesHttp503(0),
mSuccesses(0),
mByteCount(0L)
{
@@ -426,7 +450,7 @@ void WorkingSet::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * r
{
// More success
LLCore::BufferArray * data(response->getBody());
- mByteCount += data->size();
+ mByteCount += data ? data->size() : 0;
++mSuccesses;
}
else
@@ -462,6 +486,10 @@ void WorkingSet::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * r
++mErrorsApi;
}
}
+ unsigned int retry(0U), retry_503(0U);
+ response->getRetries(&retry, &retry_503);
+ mRetries += int(retry);
+ mRetriesHttp503 += int(retry_503);
mHandles.erase(it);
}