A
A
Alexey Anisimov2017-01-24 10:23:40
symfony
Alexey Anisimov, 2017-01-24 10:23:40

Symfony 2.8 firewall is very slow. Why?

Good afternoon.
There is a project on symfony 2.8 standard edition that does not use a database ( without doctrine and swiftmailer). Accordingly, there are no extra settings in the config (parameters for connecting to the database, and so on).
All data is obtained from the api of a third-party service (don’t ask why then you don’t like it on the symphony, and not the js-framework, but the customer wanted it that way)
In the prod environment on the server (php 7) , the firewall works for a very long time . It also happens in dev on local, but the difference is 10 times in time.
app/config/security.yml file code

security:

    providers:
        in_memory:
            memory: ~

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            anonymous: true
            pattern: ^/.*
            form_login:
                always_use_default_target_path: false
                default_target_path: /
                target_path_parameter: _target_path
                use_referer: true
                login_path: user_registration_page

    access_control:
        - { path: ^/login_check, roles: IS_AUTHENTICATED_ANONYMOUSLY }
# и так далее

Prinscreen from profiler from server (prod)
dbb6c31b7b2c4494a8f8bcb4a84a15e3.png
Prinscreen from profiler from local (dev)
09d7c4f1ae614f40a30fde08f4439983.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Anisimov, 2017-01-26
@AnisimovAM

Found out what the problem was. Installed the BlackFire.io profiler (by SensioLabs). About 99% of the time the curl_exec() function was executing. It was useful to deal with it, it turned out that requests to api via curl (I use the guzzle client) sometimes took a very long time. I set the chaser ipv4 execution flag and everything quickly worked.
Bottom line - the problem is not in the firewall (although symfony web-profiler pointed to it), but in the conversion of the domain to ip.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question