Swoole HTTP Server Consolidated PHALCON,AB test, reporting PHP memory exhaustion

Source: Internet
Author: User
In the consolidated Swoole HTTP server and phalcon,server.php are as follows:


  Registerdirs (Array ('.. /apps/controllers/', '.        /apps/models/'));    $loader->register (); }/** * This methods registers the services to being used by the application */protected function Registerserv        Ices () {$di = new Di ();        Registering a router $di->set (' Router ', function () {return new router ();        });        Registering a Dispatcher $di->set (' Dispatcher ', function () {return new dispatcher ();        });        Registering a http\response $di->set (' Response ', function () {return new Response ();        });        Registering a http\request $di->set (' Request ', function () {return new Request ();        });            Registering the View component $di->set (' View ', function () {$view = new view (); $view->setviewsdir ('..            /apps/views/');        return $view;        }); $di->set (' db ', function () {return new Database (Array ("host" = "localhost", "username" = "ro")        OT "," password "=", "" dbname "=" invo ");        });         Registering the Models-metadata $di->set (' Modelsmetadata ', function () {return new Memorymetadata ();        });        Registering the Models Manager $di->set (' Modelsmanager ', function () {return new Modelsmanager ();        });    $this->setdi ($DI);        The public Function main () {$this->registerservices ();    $this->registerautoloaders (); }} $application = null, $http = new Swoole_http_server ("0.0.0.0", 9501), $http->on (' request ', function ($request, $        Response) {try {$_get = $_post = $_cookie = $_request = [];            if (!empty ($request->get)) {$_get = $request->get;        $_request + = $_get;        } if (!empty ($request->post)) {    $_post = $request->post;        $_request + = $_post;        } if (!empty ($request->cookie)) {$_cookie = $request->cookie;        } Global $application;        $html = $application->handle ($request->server[' Request_uri '))->getcontent ();    $response->end ($html);        } catch (\exception $e) {print_r ($e);    echo $e->getmessage ();    }}); $http->on (' Workerstart ', function ($server, $workerId) {global $application;    $application = new Application (); $application->main ();}); # Boot server $http->start ();

No problem with browser access
The AB test is an error.

ab -n 10000 -c 1000 -rk http://phalcon.com/

Error message:

[root@localhost public]# [2016-08-25 17:12:45 *12502.0]    ERROR    zm_deactivate_swoole (ERROR 103): Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16384 bytes) in /srv/www/single/public/server.php on line 126.[2016-08-25 17:12:45 $12497.0]    WARNING    swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0

Ask what is the reason for this, is onrequest there write wrong?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.