Kafka max.poll.records: what reducing it does (default 500)
Codemia Knowledge Hub ·
max.poll.records caps how many records one poll() call returns, and its default is 500. Lowering it makes each poll loop shorter, so the consumer commits more often and responds faster to rebalances, at the cost of throughput. It is the main lever for avoiding max.poll.interval.ms timeouts when per-record processing is slow, but tune it together with max.poll.interval.ms, fetch.min.bytes and fetch.max.wait.ms.
What max.poll.records controls
Each poll() returns at most max.poll.records records from the client's internal prefetch buffer. It does not control how much data is fetched from the broker per network request (that is fetch.max.bytes and max.partition.fetch.bytes). Data is still prefetched in larger batches and buffered in memory. The setting only limits how many records reach your code per poll().
With max.poll.records=50 and 200ms per record, the worst case per poll() is 10 seconds. With the default of 500 it would be 100 seconds. That still fits within the default max.poll.interval.ms of 300,000ms (5 minutes), but at 1,000ms per record (as in the sizing example below) 500 records would take 500 seconds, exceed the limit and trigger a rebalance.
What changes when you reduce it
Shorter poll loop cycles
Smaller batches mean each loop finishes sooner and the consumer calls poll() more often, so the group coordinator keeps treating it as alive.
More frequent commits
If you commit after each poll() cycle (the common pattern), commits happen more often, so less data is reprocessed after a crash.
Lower throughput
Each poll() has fixed overhead: the network round-trip, deserialization setup and coordinator communication. Smaller batches spread that cost over fewer records. More frequent polls also mean more coordinator traffic, more commit requests and more broker-side work, so the change is not free.
Faster rebalances
During a rebalance, a consumer must finish processing its current poll() batch before it can take part. A smaller batch finishes sooner, which shortens the pause for the whole consumer group.
Trade-offs at a glance
| Metric | Higher max.poll.records | Lower max.poll.records |
| Throughput | Higher (better amortization) | Lower (more overhead per record) |
| Latency per batch | Higher | Lower |
| Rebalance responsiveness | Slower | Faster |
| Commit frequency | Less frequent | More frequent |
| Reprocessing after crash | More records replayed | Fewer records replayed |
| Risk of poll timeout | Higher | Lower |
| Network overhead ratio | Lower | Higher |
Do not set it very low (for example 1) "for safety". Every record then pays the full overhead of a poll() cycle and throughput collapses.
Settings that interact with it
A common mistake is lowering max.poll.records without adjusting fetch.min.bytes. If the broker waits to accumulate 1MB before responding but you only process 50 records per poll, the prefetch buffer fills and the excess sits in memory for later poll() calls. Memory pressure goes up without any gain in responsiveness.
How the fetch and poll settings fit together
Sizing max.poll.records
Measure worst-case per-record processing time first, then estimate:
The safety factor covers GC pauses, network latency spikes and slow downstream services. 2x is a reasonable starting point.
If processing is simply too slow, lowering max.poll.records treats the symptom. Also consider async processing, a larger max.poll.interval.ms, or moving heavy work to a separate thread pool.
Spring Kafka configuration
In Spring Boot, set it in application properties:
Or programmatically in the consumer factory:
Metrics to watch after the change
- consumer_lag: should stay stable or fall. Rising lag means throughput dropped too far.
- records-consumed-rate: total records per second. Expect a small decrease.
- poll-rate:
poll()calls per second. Should rise proportionally. - commit-rate: should rise, confirming more frequent commits.
- rebalance count: should fall if poll timeouts were causing rebalances.
Related reading
- Implement Kafka Streams Processor in .Net?
- Implement Reactive Kafka Listener in Spring Boot application
- Implementing a kafka connect custom partitioner
- Implementing fault tolerance in distributed message queues
- Implementation consistent replica in peer-to-peer application
- Implementation of distributed greedy algorithm for finding maximum independent set
- Impact of Xcode build options Enable bitcode Yes/No
- Implement a queue in which push_rear, pop_front and get_min are all constant time operations
System design interview problems on this topic
- Design a Distributed Messaging System: solution and walkthrough
- Design a Log Collection and Analysis System: solution and walkthrough
- Design an Ad Click Aggregation System: solution and walkthrough
- Design a Webhook Notification Service: solution and walkthrough

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseSystem Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.