-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
To reproduce:
@pytest.mark.asyncio
@dfly_args({"proactor_threads": 4})
async def test_set_performance(df_factory: DflyInstanceFactory, df_seeder_factory):
master = df_factory.create()
replica = df_factory.create()
df_factory.start_all([master, replica])
m_client = master.client()
r_client = replica.client()
logging.debug("DEBUG POPULATE")
key_num = 1000000
await m_client.execute_command("debug", "populate", key_num, "test", "160", "RAND")
dbsize = await m_client.dbsize()
assert dbsize > (key_num * 0.95)
stop = False
async def run_sets():
client = master.client()
while not stop:
pipeline = client.pipeline(transaction=False)
for _ in range(80):
pipeline.execute_command(f"set test:{random.randint(1, key_num)} fooooo")
val = await pipeline.execute()
await client.close()
seed_task = [asyncio.create_task(run_sets()) for _ in range(20)]
await asyncio.sleep(5)
stop = True
for seed in seed_task:
await seed
info = await m_client.info("commandstats")
logging.debug(f"info before replication is {info}")
master.stop()
# Reset
master.start()
m_client = master.client()
await m_client.execute_command("debug", "populate", key_num, "test", "160", "RAND")
stop = False
logging.debug("Start replication")
assert "OK" == await r_client.execute_command(f"REPLICAOF localhost {master.port}")
seed_task = [asyncio.create_task(run_sets()) for _ in range(20)]
await wait_for_replicas_state(r_client, timeout=60)
info = await m_client.info("commandstats")
logging.debug(f"info after replication is {info}")
stop = True
for seed in seed_task:
await seed
logging.debug("Set finished")
Results on opt-build locally:
'cmdstat_set': {'calls': 1448000, 'usec': 322803, 'usec_per_call': 0.22293}
with replication during full sync:
set': {'calls': 4130785, 'usec': 68150755, 'usec_per_call': 16.4983}
That's 80x slowdown
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working