You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Jay Kreps (JIRA)" <ji...@apache.org> on 2015/02/08 00:27:34 UTC
[jira] [Resolved] (KAFKA-744) Bad response time for fetch request
[ https://issues.apache.org/jira/browse/KAFKA-744?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jay Kreps resolved KAFKA-744.
-----------------------------
Resolution: Invalid
Ancient.
> Bad response time for fetch request
> -----------------------------------
>
> Key: KAFKA-744
> URL: https://issues.apache.org/jira/browse/KAFKA-744
> Project: Kafka
> Issue Type: Bug
> Reporter: Danny Yeshurun
>
> Getting a response to a fetch request from an empty partition after the first time takes lots of time.
> example:
> Post a fetch request to topic 'test' partition 0 which has no data in it, you get the response in ~0.0005 sec. When posting the same request for the second time (still no data the response time is ~0.04 sec.
> Following is a simplistic php script that demonstrate the problem (note that the time is measured for the 1st read)
> $host = "your-kafka-ip:port";
> $socket = stream_socket_client($host);
> if (!$socket) {
> print "can't connect\n";
> exit;
> }
> $topic = 'test';
> $data = pack('n', 1); // fetch
> $data .= pack('n', strlen($topic)) . $topic;//short string
> $data .= pack('N', 0);//partition
> $data .= str_repeat(chr(0), 8);//offset
> $data .= pack('N', 1000); //max size
> $requestSize = strlen($data);
> for ($i = 0; $i < 10; $i++) {
> fwrite($socket, pack('N', $requestSize));
> fwrite($socket, $data);
> $ts = microtime(true);
> $bytes32 = fread($socket, 4);
> $ts = microtime(true) - $ts;
> print "> {$ts}\n";
> $responseSize = current(unpack('N', $bytes32));
> $bytes16 = fread($socket,2);
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)