ambry icon indicating copy to clipboard operation
ambry copied to clipboard

Add TTL option for NettyPerfClient

Open zzmao opened this issue 5 years ago • 3 comments

NettyPerfClient is a Netty based tool to generate PUT/GET traffic to frontend.

CLI to run this tool:

java -Dlog4j.configuration=file:../config/log4j.properties -cp ambry.jar com.github.ambry.tools.perf.rest.NettyPerfClient --hosts localhost  --port 1174 --requestType POST --concurrency 10 --postBlobTotalSize 100 --postBlobChunkSize 100 --targetAccountName ambry_hadoop_test_account --targetContainerName ambry_hadoop_test_cntr

The tool is lack of a TTL option, without it all blob PUT to ambry is infinity. We want to have an option for Blob TTL when issue a command.

Core change: NettyPerfClient:

    private void reset() {
      if (chunk != null) {
        chunkedInput = new HttpChunkedInput(new RepeatedBytesInput());
        request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, path);
        HttpUtil.setContentLength(request, totalSize);
        request.headers().add(RestUtils.Headers.BLOB_SIZE, totalSize);
        request.headers().add(RestUtils.Headers.SERVICE_ID, serviceId);
        request.headers().add(RestUtils.Headers.AMBRY_CONTENT_TYPE, "application/octet-stream");
        request.headers().add(RestUtils.Headers.TARGET_ACCOUNT_NAME, targetAccountName);
        request.headers().add(RestUtils.Headers.TARGET_CONTAINER_NAME, targetContainerName);
        ++ request.headers().add(RestUtils.Headers.TTL, 86400); // make 86400 configureable. a.k.a pass in from CLI. 
      } else {

zzmao avatar Mar 25 '20 20:03 zzmao

@zemao, we do have TTL option for NettyPerClient

jsjtzyy avatar Mar 26 '20 02:03 jsjtzyy

Sorry, my bad, we can set ttl in the header

--hosts ltx1-app1436.stg.linkedin.com --port 3183 --requestType POST --concurrency 2 --targetQPS 15 --testTime 30 --postBlobTotalSize 512 --postBlobChunkSize 512 --targetAccountName ambryClientUnitTest --targetContainerName container-a --customHeader x-ambry-ttl:36000 --customHeader x-li-ambry-client:Internal --sslPropsFilePath PerfClientSSLConfig

jsjtzyy avatar Mar 26 '20 02:03 jsjtzyy

I see. I open this ticket for Sophie, for her to practice development process on this one. --customHeader x-ambry-ttl:36000 is good. We can also add an explicitly option, --blobTtl.

zzmao avatar Mar 26 '20 16:03 zzmao