-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delay in consumer after message is send using simple producer #44
Comments
I've had similar problems - the best I've managed so far is to change DefaultMaxBlockingWaitTime in the FetchRequest class from 5000ms right down to 100ms, that definitely helps but it's not instant. I'm sure there must be some other settings which I'm missing. |
The consumer is supposed to be connecting to the brokers and using a polling query that is waiting for a particular amount of data to show up in the topic before returning the results. This might not be set with the best default. Ill have a look at the consumer tomorrow. There are a few bug fixes in the Tcp connection handling that I have queued that should go out which might help. |
I think the two settings you are looking for are this (unfortunately I have not made these readily available to change in the code). Ill add that.
The max wait time is the maximum amount of time in milliseconds to block waiting if insufficient data is available at the time the request is issued.
This is the minimum number of bytes of messages that must be available to give a response. If the client sets this to 0 the server will always respond immediately, however if there is no new data since their last request they will just get back empty message sets. If this is set to 1, the server will respond as soon as at least one partition has at least 1 byte of data or the specified timeout occurs. By setting higher values in combination with the timeout the consumer can tune for throughput and trade a little additional latency for reading only large chunks of data (e.g. setting MaxWaitTime to 100 ms and setting MinBytes to 64k would allow the server to wait up to 100ms to try to accumulate 64k of data before responding). |
You can now add in the options the ability to modify the MaxWaitTime and MinBytes to increase responsive throughput of the consumer when messages arrive.
You can now tune the values. Grab the latest nuget. |
Great, thanks ! |
Perfect - I'll give it a try! |
Hi
I'm sending a message using this python code:
client = KafkaClient("localhost:9092")
producer = SimpleProducer(client)
producer.send_messages("mytopic", bytes("some msg", 'utf-8'))
Then i am consuming it using kafka-net in the following way:
foreach (var message in consumer.Consume())
{
// do something with the message
}
My problem is that once a message is sent, it takes between 1-2 up to 10 seconds until it is consumed in jafka-net. Is this normal? I'm using default Kafka /zookeeper configs.
My expectation is that messages are received immediatelly.
Thanks
Angel
The text was updated successfully, but these errors were encountered: