bzp2010 commented on code in PR #12338:
URL: https://github.com/apache/apisix/pull/12338#discussion_r2159870165
##########
apisix/plugins/kafka-logger.lua:
##########
@@ -255,7 +264,7 @@ function _M.log(conf, ctx)
entry = log_util.get_log_entry(plugin_name, conf, ctx)
end
- if batch_processor_manager:add_entry(conf, entry) then
+ if batch_processor_manager:add_entry(conf, entry, max_pending_entries) then
return
Review Comment:
1. These need to be handled by the batch processor and not some plugin. This
is a generic capability.
##########
apisix/plugins/kafka-logger.lua:
##########
@@ -255,7 +264,7 @@ function _M.log(conf, ctx)
entry = log_util.get_log_entry(plugin_name, conf, ctx)
end
- if batch_processor_manager:add_entry(conf, entry) then
+ if batch_processor_manager:add_entry(conf, entry, max_pending_entries) then
return
Review Comment:
2. If all the other batch processor configurations are in `conf`, why add a
special configuration and place it in the plugin metadata?
##########
apisix/utils/batch-processor-manager.lua:
##########
@@ -94,11 +113,22 @@ function _M:add_entry(conf, entry)
end
log_buffer:push(entry)
+ self.total_pushed_entries = self.total_pushed_entries + 1
return true
end
-function _M:add_entry_to_new_processor(conf, entry, ctx, func)
+function _M:add_entry_to_new_processor(conf, entry, ctx, func,
max_pending_entries)
+ if max_pending_entries then
+ local total_processed_entries_count = total_processed_entries(self)
+ if self.total_pushed_entries - total_processed_entries_count >
max_pending_entries then
+ core.log.error("max pending entries limit exceeded. discarding
entry.",
+ " total_pushed_entries: ",
self.total_pushed_entries,
+ " total_processed_entries: ",
total_processed_entries_count,
+ " max_pending_entries: ", max_pending_entries)
Review Comment:
Also both achieve their purpose by discarding log entries, how does it
differ from the existing control of the maximum buffer achieved by reducing the
number of retries?
This mechanism discards logs before data is added to the buffer, dealing a
serious blow to the reliability and meaning of logging. What's the point of a
logging mechanism that isn't even remotely explainable if logs can be discarded
on the fly and without warning?
A log may be discarded at runtime under a variety of different conditions,
and the user will find that a batch of logs critical to his diagnosis of a
failure has strangely disappeared from the dataset, an obvious blow to his
confidence.
----
If some guys are causing massive memory consumption or even OOM because of
all this caching.
Obviously the first thing that should come under scrutiny is whether its
log-receiving system has enough capacity to accept the entirety of the logs,
and if it doesn't, that's not APISIX's concern, and it's not our problem.
Reliable delivery of diagnostic material at all times is what we should be
looking at.
The second step that should be scrutinized is whether these users have
sufficient memory resources (both the memory limit of the pod and the entire
node) reserved for APISIX operation. What does it matter to us if none of their
memory consumption has been properly evaluated and thus pre-configured with
unreasonable memory limits, resulting in processes being killed by the kernel?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]