Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to show a fail whale?

Tags:

php

How or when do I know my Web Application can't handle the traffic/activities and show a "Fail Whale" kind of page?

like image 649
ptamzz Avatar asked Jan 29 '11 04:01

ptamzz


1 Answers

You could try sys_getloadavg() if you just want to show an error when the server is under high load.

<?php
    $load = sys_getloadavg();
    $max_load = 95;

    if($load[0] >= $max_load){
        // Show failwhale
    }else{
        // Do stuff
    }
?>
like image 122
Joseph W Avatar answered Oct 10 '22 00:10

Joseph W



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!