Ao pesquisar um arquivo de biblioteca a partir de uma pasta correta, meu aplicativo atualmente faz alguns dos lstats para as possíveis localizações de locais. Agora eu estou querendo saber se estes lstat (aplicativo está sendo um serviço da web, portanto, pode haver centenas de lstat por segundo) causar sempre uma busca de disco adicional, ou são aqueles busca em cache?
O sistema é Linux (kernel 2.6) com sistema de arquivos baseado em ext4.
Parte do strace PHP-CGI:
Strace PHP-CGI:
lstat("/home/www/mydomain.com/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a710) = -1 ENOENT (No such file or directory)
lstat("/usr/share/php/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a710) = -1 ENOENT (No such file or directory)
getcwd("/home/www/mydomain.com/misc", 4096) = 32
lstat("/home/www/mydomain.com/misc/./inc/myLibrary/php/classes/myClass.php", 0x7fffa805a710) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/inc/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a710) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a660) = -1 ENOENT (No such file or directory)
lstat("/usr/share/php/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a660) = -1 ENOENT (No such file or directory)
getcwd("/home/www/mydomain.com/misc", 4096) = 32
lstat("/home/www/mydomain.com/misc/./inc/myLibrary/php/classes/myClass.php", 0x7fffa805a660) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/inc/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a660) = -1 ENOENT (No such file or directory)
getcwd("/home/www/mydomain.com/misc", 4096) = 32
lstat("/home/www/mydomain.com/misc/inc/myLibrary/php/classes/myClass.php", 0x7fffa805c7c0) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/misc/inc/myLibrary/php/classes", 0x7fffa805c600) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/misc/inc/myLibrary/php", 0x7fffa805c450) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/misc/inc/myLibrary", 0x7fffa805c2a0) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/misc/inc", 0x7fffa805c0f0) = -1 ENOENT (No such file or directory)
open("/home/www/mydomain.com/misc/inc/myLibrary/php/classes/myClass.php", O_RDONLY) = -1 ENOENT (No such file or directory)
/* FILE FOUND */
open("/home/www/mydomain.com/inc/classes/myClass.php", O_RDONLY) = 7
fstat(7, {st_mode=S_IFREG|0775, st_size=7734, ...}) = 0
fstat(7, {st_mode=S_IFREG|0775, st_size=7734, ...}) = 0
fstat(7, {st_mode=S_IFREG|0775, st_size=7734, ...}) = 0
fstat(7, {st_mode=S_IFREG|0775, st_size=7734, ...}) = 0
mmap(NULL, 7734, PROT_READ, MAP_SHARED, 7, 0) = 0x7f2225786000
stat("/home/www/mydomain.com/inc/classes/myClass.php", {st_mode=S_IFREG|0775, st_size=7734, ...}) = 0