Skip to content

performance optimization: choice of concurrent queue #287

Description

@fommil

https://github.com/DataDog/java-dogstatsd-client/blob/master/src/main/java/com/timgroup/statsd/StatsDNonBlockingProcessor.java#L54

defines a

this.messages = new ConcurrentLinkedQueue<>();

to buffer messages before sending. This results in a lot of object allocations as every message also gets a queue node created. It would be useful to consider a bounded alternative like ArrayBlockingQueue with ~million entries (configurable with a property). It looks like offer is already being used instead of add so this would also cap the memory limits of the application.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions