-
-
Save renan/3761745 to your computer and use it in GitHub Desktop.
Session Locking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure you copy-paste all commands, so there is no delay between them | |
wget -q http://localhost/test.php -O first.txt & | |
sleep 1s | |
wget -q http://localhost/test.php -O second.txt | |
cat first.txt second.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3.1705009937286 | |
5.171688079834 | |
The second request will be always take 2 seconds more to finish, because its waiting for the first request to be completed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_id('sessionConcurrentTest'); | |
session_start(); | |
sleep(3); | |
echo (microtime(true) - $_SERVER['REQUEST_TIME']) . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment