Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. queue

queue

MITGov1.7.0

A Go package offering thread-safe generic implementations of BlockingQueue, PriorityQueue, CircularQueue, and Linked Queue.

Visit WebsiteGitHubGitHub
361 stars15 forks0 contributors

What is queue?

Queue is a Go package that provides multiple thread-safe, generic queue implementations, including BlockingQueue, PriorityQueue, CircularQueue, and Linked Queue. It solves the need for efficient, concurrent data structures in Go applications by offering a consistent API and robust synchronization.

Target Audience

Go developers building applications that require concurrent data handling, such as task schedulers, message brokers, or systems needing priority-based or fixed-size buffering.

Value Proposition

Developers choose this package for its thread-safe designs, generic type support, and variety of queue implementations—all through a unified interface, making it a reliable alternative to building custom queue logic from scratch.

Overview

⏪️ Go package providing multiple queue implementations. Developed in a thread-safe generic way.

Use Cases

Best For

  • Implementing task queues in concurrent Go services
  • Building priority-based job schedulers
  • Creating fixed-size buffers for streaming data
  • Developing thread-safe producer-consumer patterns
  • Adding efficient linked list queues with O(1) operations
  • Replacing custom queue logic with standardized implementations

Not Ideal For

  • Applications requiring distributed queueing or persistent storage across restarts
  • Systems where zero memory allocations per operation are critical for ultra-high performance
  • Use cases needing dynamic priority updates in a priority queue without manual re-queueing
  • Simple, single-threaded scripts where synchronization overhead is unnecessary and adds complexity

Pros & Cons

Pros

Thread-Safe by Design

All implementations are built for concurrent use, with BlockingQueue using sync.Cond for synchronization, ensuring safe data handling in multi-goroutine environments as emphasized in the README.

Consistent API Interface

A unified Queue interface allows easy swapping of queue types without code changes, demonstrated in the usage examples where all queues implement the same methods like Offer and Get.

Multiple Queue Types

Offers four specialized implementations: BlockingQueue for FIFO with blocking ops, PriorityQueue with custom comparator, CircularQueue for fixed-size buffering, and Linked Queue for O(1) operations, catering to diverse needs.

Generic Type Support

Supports Go generics for type-safe usage with any comparable data type, as defined in the Queue[T comparable] interface, reducing runtime errors.

Performance Optimized

Benchmarks show efficient operations, e.g., Linked Queue Peek at 0.4179 ns/op and low latency for other queues, indicating suitability for high-throughput scenarios.

Cons

In-Memory Only

Lacks persistence features; all queue data is volatile and lost on application restart, which may not suit use cases requiring durability like task queues in crash-recovery systems.

Allocation Overhead in Linked Queue

Benchmarks reveal that Linked Queue operations involve memory allocations (1 alloc/op for Offer and Get_Offer), potentially impacting garbage collection in allocation-sensitive environments.

Limited to Comparable Types

The Queue interface requires T comparable, restricting usage to types with defined equality, which might exclude complex custom structs without implementing comparison logic.

No Built-in Timeout Support

BlockingQueue's blocking methods don't include timeout mechanisms out of the box, requiring additional code for scenarios where operations need to time out, as not mentioned in the README.

Frequently Asked Questions

Quick Stats

Stars361
Forks15
Contributors0
Open Issues1
Last commit1 day ago
CreatedSince 2022

Tags

#circular-buffer#queue#blocking-queue#generic#data-structures#thread-safe#priority-queue#golang#linked-list#concurrency#go#generic-programming

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 6 hours ago

Related Projects

hatchethatchet

🪓 An orchestration engine for background tasks, AI agents, and durable workflows

Stars7,503
Forks446
Last commit13 hours ago
dequedeque

Fast ring-buffer deque (double-ended queue)

Stars784
Forks67
Last commit12 days ago
goconcurrentqueuegoconcurrentqueue

Go concurrent-safe, goroutine-safe, thread-safe queue

Stars434
Forks35
Last commit3 years ago
dequedeque

A highly optimized double-ended queue

Stars207
Forks7
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub