Skip to content

[Lock][Semaphore] Leverage Redis eval caching #40883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jderusse
Copy link
Member

@jderusse jderusse commented Apr 20, 2021

Q A
Branch? 5.x
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #40820
License MIT
Doc PR

@carsonbot carsonbot changed the title Leverage Redis eval caching [Lock][Semaphore] Leverage Redis eval caching Apr 20, 2021
@jderusse jderusse added this to the 5.x milestone Apr 20, 2021
@nicolas-grekas
Copy link
Member

Can you please confirm that this provides any practical benefit?
I feel like the Lua scripts are small enough and that this might provide nothing in practice.

@jderusse
Copy link
Member Author

Every time the lock is aquired OR tried to be acquired, the script is sent.

Here is a reproducer:

<?php

include(__dir__.'/vendor/autoload.php');

$redis = new \Redis();
$redis->connect('127.0.0.1');
$store = new \Symfony\Component\Lock\Store\RedisStore($redis);
$factory = new \Symfony\Component\Lock\LockFactory($store);

$lock = $factory->createLock('test');

echo 'Init'.PHP_EOL;
$lock->acquire(true);
echo 'Acquire'.PHP_EOL;
sleep(5);
$lock->release(true);
echo 'Release'.PHP_EOL;

I launched this script twice to get concurent access and retries in blocking part. See Network part of https://blackfire.io/profiles/compare/1c91192d-a1c4-4451-837c-839a1df61e54/graph

@nicolas-grekas
Copy link
Member

Thanks for the Blackfire comparison!
I'm not really convinced this is worth the added complexity personally...

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

Successfully merging this pull request may close these issues.

[Semaphore] Cache lua files in memory. Minify lua files
3 participants