php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #71052 Improvement: file operations 3 times slower than Linux on GlusterFS mount
Submitted: 2015-12-07 15:47 UTC Modified: -
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: oytuntez at gmail dot com Assigned:
Status: Open Package: Filesystem function related
PHP Version: 5.6.16 OS: Amazon Linux AMI 2015.09
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-12-07 15:47 UTC] oytuntez at gmail dot com
Description:
------------
Purpose: move a file from local mount to a GlusterFS mount.
File: 16MB XML.

Vanilla PHP operation: use `rename()` to move the file.
Linux command: shell_exec("mv '$sourcePath' '$targetPath'")

Note: My glusterFS mount has a terrible performance at the moment, writes usually around 2MB/s, so it is making a good testing environment for read/write operations.

Result:
- PHP rename() takes about 56.2257 seconds to move the file.
- Linux command via shell_exec takes 15.8680s.


The latter takes 3.5433 less time than PHP's rename().

Test script:
---------------
$path1 = '/tmp/1220631606.xliff';
$path2 = '/gluster_mount/'.rand();

$start = microtime(true);
rename($path1, $path2);
$end = microtime(true);

echo 'rename time: '.($end-$start).PHP_EOL;

$start = microtime(true);
shell_exec("mv '".$path1."' '".$path2."'");
$end = microtime(true);

echo 'shell_exec time: '.($end-$start).PHP_EOL;


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Mon Jul 16 10:01:53 2018 UTC