LPOP
Syntax
LPOP key [count]
Time complexity: O(N) where N is the number of elements returned
ACL categories: @write, @list, @fast
Removes and returns the first elements of the list stored at key.
By default, the command pops a single element from the beginning of the list.
When provided with the optional count argument, the reply will consist of up
to count elements, depending on the list's length.
Return
When called without the count argument:
Bulk string reply: the value of the first element, or nil when key does not exist.
When called with the count argument:
Array reply: list of popped elements, or nil when key does not exist.
Examples
dragonfly> RPUSH mylist "one" "two" "three" "four" "five"
(integer) 5
dragonfly> LPOP mylist
"one"
dragonfly> LPOP mylist 2
1) "two"
2) "three"
dragonfly> LRANGE mylist 0 -1
1) "four"
2) "five"
Benchmark
Sustained throughput for LPOP on a single instance, measured against Redis and Valkey on identical hardware. Higher is better.
| Engine | Throughput | p50 | p99 | p99.9 | Avg Latency |
|---|---|---|---|---|---|
| Dragonfly | 10.25M ops/s | 0.432 ms | 0.871 ms | 3.507 ms | 0.456 ms |
| Valkey | 1.69M ops/s | 1.535 ms | 10.042 ms | 11.804 ms | 2.822 ms |
| Redis | 1.33M ops/s | 1.562 ms | 11.894 ms | 13.783 ms | 3.588 ms |
Methodology
| Hardware | Server: m7g.8xlarge (arm64) · Client: c6gn.8xlarge (arm64) |
| Client | 32 threads, 5 connections, pipeline 30 |
| Dataset | 1M keys, 100 preloaded items each, 128B values, uniform key distribution |
| Duration | 300s (10s warmup), 1 trial |
| Measured | 2026-07-29 |
Ran through dfly_bench until throughput stabilized; the reported figure is the median throughput sampled during the run. Harness and raw output: dragonflydb/benchmarking.