Skip to main content

RPOP

Syntax​

RPOP key [count]

Time complexity: O(N) where N is the number of elements returned

ACL categories: @write, @list, @fast

Removes and returns the last elements of the list stored at key.

By default, the command pops a single element from the end 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 last 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> RPOP mylist
"five"
dragonfly> RPOP mylist 2
1) "four"
2) "three"
dragonfly> LRANGE mylist 0 -1
1) "one"
2) "two"

Benchmark​

Sustained throughput for RPOP on a single instance, measured against Redis and Valkey on identical hardware. Higher is better.

Dragonfly10,670,000OPS
Valkey1,810,0005.9× OPS
Redis1,490,0007.2× OPS
02.75M5.5M8.25M11.0M
operations / second
EngineThroughputp50p99p99.9Avg Latency
Dragonfly10.67M ops/s0.416 ms0.792 ms3.282 ms0.437 ms
Valkey1.81M ops/s1.532 ms9.645 ms11.570 ms2.639 ms
Redis1.49M ops/s1.550 ms11.361 ms11.985 ms3.217 ms

Methodology

HardwareServer: m7g.8xlarge (arm64) · Client: c6gn.8xlarge (arm64)
Client32 threads, 5 connections, pipeline 30
Dataset1M keys, 100 preloaded items each, 128B values, uniform key distribution
Duration300s (10s warmup), 1 trial
Measured2026-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.