Efficiently delete a million files on Linux servers

Efficiently delete a million files on Linux servers

Blog
It happens to the best: some script rockets to the skyline resulting in an instand system administrator headache because some folder - typically, sessions - was stuffed with millions of files. Linux is not quite happy with that, deleting the folder is not an option and the loyal "rm -rf" command decides to call it a day. To make things even worse: you want to remove only files of some days ago... what are the options? Find is you friend The Linux "find" command is a possible solution, many will go for: find /yourmagicmap/* -type f -mtime +3 -exec rm -f {} \; The command above will give a list of files older than 3 days and will pass each found file to the rm command. The rule above has…
Read More
PHP MVC Framework Showdown: 7.1 Performance

PHP MVC Framework Showdown: 7.1 Performance

Blog
A simple performance comparison of 6 PHP MVC style frameworks using PHP 7.1. Test Kit: php-framework-benchmarkTest Server: Digital Ocean Ubuntu 16.04.1 x64 2gb / 2CPU droplet.Test Software: PHP 7.1.0, Apache 2.4.18 I used a minimal installation of PHP and Apache with no additional configurations or sever settings changed. Overview The benchmark tool kit executes a simple “hello world”, it does this with the frameworks minimal settings, no database, no debugging and if possible, no template engine. Read more about the testing on the benchmark tool kits page. Results Out of the 6 frameworks tested Codeigniter 3 produced the most requests per second and the least memory usage. Zend Framework 2.5 produced the least requests per second and Laravel 5.3 produced the most memory usage. No framework: 7,094 requests per second,…
Read More
What’s New in PHP 7.3 in 30 Seconds in Diffs

What’s New in PHP 7.3 in 30 Seconds in Diffs

Blog
No time but eager to hear PHP news? PHP 7.3 is out in December 2018 and it brings 173 changes. Which are the most useful ones? From features that might be the most interesting to those lesser ones, that anybody will rarely use. 1. Comma After the Last Argument Do you know this? $array = [ 1, + 2, ]; We'll be able to do this: $this->someFunction( $arg, + $arg2, ); But still not this: function someFunction( $arg, + $arg2, ) {} Thanks Jacob for pointing this difference out. 25 seconds to go... 2. First and Last Array Key array_key_first $items = [ 1 => 'a', 2 => 'b', ]; -reset($items); -$firstKey = key($items); +$firstKey = array_key_first($items); var_dump($firstKey); // 1 array_key_last $items = [ 1 => 'a', 2 => 'b',…
Read More