Yes, I have also used a socket, simmer down.

 

As for the java client, I’d like to keep as little third-party code in our
product as possible. If I only need to get stats and can use a socket to do
so, I’m going with that.

 

Thanks for your two cents.

 

-ts

 

From: [email protected] [mailto:[email protected]] On
Behalf Of Henrik Schröder
Sent: Tuesday, May 25, 2010 3:11 PM
To: [email protected]
Subject: Re: Using Java to Telnet into memcached

 

No, no, no. Don't use a telnet client to connect to it programmatically,
just open a socket for crying out loud! You only need to write "stats\r\n"
to it and then read the response. Why are you needlessly complicating
things? If you use a programmatic telnet client you're gonna get something
that tries to talk the telnet protocol. It works to connect to a memcached
server with an actual telnet client, because they can usually handle the
other part not being an actual telnet server, and downgrade to a dumb socket
connection.

Also, using an actual memcached client will probably not add a noticeable
overhead, and you get the connecting to a server cluster + parsing of the
results for free. Try it first and profile it instead of assuming it's a bad
solution.


/Henrik

On Tue, May 25, 2010 at 19:34, Tim Sneed <[email protected]> wrote:

Hey all,

 

I am attempting to use a standard Java telnet client
(commons.net.TelnetClient) but am having some trouble completing the
connection. Once I run my Java test I see on the memcached console “<30 new
auto-negotiating client connection” but then it just hangs there, eventually
timing out with no exception being thrown. 

 

When I use the spymemcached I can connect no problem but I want to reduce
the overhead since I am only interested in sending the STATS command at a
set interval. Has anyone done this where they use a simple Telnet socket
connection from Java to issue commands rather than using a Java memcached
client such as spymemcached? Any info would be greatly appreciated, thanks!

 

-ts

 

Reply via email to