現在我正在關注OnMessage事件處理程序的簡單/高級消費者示例,並且性能很差。 (使用我們的C++庫)每分鐘120K消息VS(每分鐘1M消息rdkafka dotnet庫消費性能慢
可以是通過等待的onMessage事件,而不是實施繁忙的循環和使用.Consume(時間跨度)消耗所述消息延遲時間?
var config = new Config() { GroupId = "example-csharp-consumer" };
using (var consumer = new EventConsumer(config, "127.0.0.1:9092"))
{
consumer.OnMessage += (obj, msg) =>
{
string text = Encoding.UTF8.GetString(msg.Payload, 0, msg.Payload.Length);
Console.WriteLine($"Topic: {msg.Topic} Partition: {msg.Partition} Offset: {msg.Offset} {text}");
};
consumer.Subscribe(new []{"testtopic"});
consumer.Start();
Console.WriteLine("Started consumer, press enter to stop consuming");
Console.ReadLine();
}
什麼是您的平均郵件大小?什麼是消費者CPU使用率?代理(s)CPU使用率是多少? – Edenhill