Skip to content

changed List type in RequestPurgatory.Watchers#34

Closed
mdykman wants to merge 1 commit into
apache:0.8.2from
mdykman:0.8.2
Closed

changed List type in RequestPurgatory.Watchers#34
mdykman wants to merge 1 commit into
apache:0.8.2from
mdykman:0.8.2

Conversation

@mdykman

@mdykman mdykman commented Oct 6, 2014

Copy link
Copy Markdown

class Watchers is declared, having member

private val requests = new util.ArrayList[T]

in purgeSatisfied(), an iterator is created which conditionally removes elements from the list as it goes:

RequestPurgatory.scala, lines 193-201:

   val iter = requests.iterator()
    var purged = 0
    while(iter.hasNext) {
      val curr = iter.next
      if(curr.satisfied.get()) {
        iter.remove()
        purged += 1
      }
    }

Using the .remove operation on an ArrayList iterator is very expensive as the ArrayList promises a contiguous backing array and all higher elements must be shifted on every operation.

A LinkedList is optimized for for the removal of arbitrary elements. Therefore recommending:

  • private val requests = new util.ArrayList[T]
  • private val requests = new util.LinkedList[T]

This case was identified due to an observed failure In a high-load production environment, which found one or more cores pinned (ie. @100 usage) insider this loop. Once the pin was established, it tended to remain until the system was restarted.

As the loop is within a synchronized block, checkAndMaybeAdd (0.8.2) or add (0.8.1) which are also synchronized on the same object, may become blocked by this inefficiency.

ymatsuda referenced this pull request in confluentinc/kafka Aug 5, 2015
fix vararg in KStreamContextImpl.from()
guozhangwang added a commit to guozhangwang/kafka that referenced this pull request Sep 9, 2015
@rhauch rhauch mentioned this pull request Sep 23, 2015
resetius pushed a commit to resetius/kafka that referenced this pull request Apr 22, 2016
@ijuma

ijuma commented Apr 26, 2016

Copy link
Copy Markdown
Member

The change suggested in this PR was included as part of KAFKA-1989. Would you please close the PR (we cannot close it ourselves without help from Apache Infra).

@pono pono closed this Dec 26, 2016
hzxa21 added a commit to hzxa21/kafka that referenced this pull request Aug 22, 2019
…it happens (apache#34)

TICKET = KAFKA-8202
LI_DESCRIPTION =
As part of the producer delivery timeout support (KAFKA-5886, KIP-91),
the inFlightBatches map is introduced in the producer Sender but
currently the batches in that map will only be cleaned up when
completing, expiring and failing a batch. However, when batch split
happens, the original batch (created prior to the split) will never be
cleaned up from inFlightBatches map. This cause excessive memory
pressure in the producer because these zombie batches are normally big
batches and eventully it will cause OutOfMemory in the producer.

This patch addresses the issue by removing the original batch from the
Sender inFlightBatchMap after split happens. The test case in SenderTest
also gets modified accordingly to cover this scenario.

EXIT_CRITERIA = TICKET [KAFKA-8202]
efeg pushed a commit to efeg/kafka that referenced this pull request Jan 29, 2020
1. check whether old windows should be evicted on every sampling instead of waiting for the next window to be rolled out.
2. Use a adaptive epsilon in the double comparison. This avoids false failure on the big disk utilization.
satishd referenced this pull request in satishd/kafka Mar 11, 2020
Add an option to deactivate actual delete in the LocalRemoteStorageMa…
divijvaidya added a commit to divijvaidya/kafka that referenced this pull request Jan 24, 2023
* Addresses a bug in the calculation of size when retention by size is enabled for a topic with remote storage enabled.

Co-authored-by: Joel Wee <joelwee@amazon.com>
Co-authored-by: Christo Lolov <christo_lolov@yahoo.com>
lianetm pushed a commit to lianetm/kafka that referenced this pull request Aug 2, 2023
* Update PrototypeAsyncConsumer.java

* Update PrototypeAsyncConsumerTest.java
rustd referenced this pull request in rustd/pranavfinaldemokafka Feb 9, 2024
… (#34)

In apache#12695, we discovered a gap in our testing of `StandardAuthorizer`. We addressed the specific case that was failing, but I think we need to establish a better methodology for testing which incorporates randomized inputs. This patch is a start in that direction. We implement a few basic property tests using jqwik which focus on prefix searching. It catches the case from apache#12695 prior to the fix. In the future, we can extend this to cover additional operation types, principal matching, etc.

Reviewers: David Arthur <mumrah@gmail.com>

Co-authored-by: Jason Gustafson <jason@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants