Skip to content

Instantly share code, notes, and snippets.

View vinyvicente's full-sized avatar
🎯
Focusing

Vinicius vinyvicente

🎯
Focusing
View GitHub Profile
@vinyvicente
vinyvicente / nginx-tuning.md
Created September 10, 2017 19:33 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

<?php
namespace App\Listeners;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
@vinyvicente
vinyvicente / setters_dynamic.php
Created November 2, 2016 12:31
Setters create objects dynamically
<?php
public function __call($name, $arguments)
{
echo '
/**
* @var string
*/
protected $' . lcfirst(mb_substr($name, 3, mb_strlen($name) - 3)) . ';' . PHP_EOL;
return $this;
@vinyvicente
vinyvicente / array_sort_column.php
Last active March 4, 2016 17:41
Array Sort Column
<?php
/**
* @param string $column
* @param array $pieces
* @param int $direction (SORT_ASC | SORT_DESC)
* @return mixed
* @throws Exception
*/
function array_sort_column($column, $pieces, $direction = SORT_ASC)