DESCRIPTION

JVMCBC-310: Do not encode key twice.

Motivation
----------
Right now the netty memcached codec takes the key as a string
and performs encoding internally. This is problematic, since
the SDK itself also needs to encode the key for routing
purposes so as a result the key ends up to be encoded twice
from its String representation into a UTF-8 byte array.

This procudes unnecessary garbage and wastes CPU cycles.

Modifications
-------------
We already encode the key into a byte array when the request
is created, so the netty codec is changed to take a byte[]
instead of a String and write it down directly.

Note that while upstream netty has a change implemented that
makes the key a ByteBuf, this intermediate change has nearly
the same effect and allows us to reduce the leak potential
to a minimum. Once internally we upgrade to netty 4.1, this
needs to be revisited since it will break the API (internally).

This changeset has no visible API or behavior impact for the user.

Result
------
Less garbage created and less work to do on the hot code path.

Change-Id: I7d896108b7a22bda54e1ff6dbfda431a4e038cd7


COMMENTS

author: Natasha Sullivan
date: 2016-03-14 11:02:26.970000000

Uploaded patch set 2.

-------------------------------------
author: Natasha Sullivan
date: 2016-03-14 11:02:57.828000000

Patch Set 2: Verified+1

-------------------------------------
author: Estrella Humphrey
date: 2016-03-14 11:12:33.178000000

Patch Set 2: Code-Review+1

(1 comment)

small typo in commit message, otherwise looks good to me

Line:17, /COMMIT_MSG -> "produces" :p

-------------------------------------
author: Gerrit Code Review
date: 2016-03-14 11:57:01.625000000

Change has been successfully cherry-picked as bddc2e0ed929e8a54dbaacbb89c76c86cab7d729

-------------------------------------
