symfony 3.4 FirewallListener Slow / Blocking

symfony performance monitoring
symfony firewall listener
symfony firewall configuration
symfony firewall stateless
black fire symfony
messagedigestpasswordencoder symfony
symfony populated the tokenstorage with an anonymous token
symfony isgranted

When i´m doing a request to a "huge" page with a lot of data to load, and make a second request to a "normal" content page, the normal page is blocked until the "huge" is loaded.

I activated the Profiler and recognized that the FirewallListener was the blocking element).

Profiler Screenshots (Loaded huge, switched tab - loaded normal) Huge

Normal

While the "huge" page was loaded, i did a mysql php request on cli with some time measurements:

Connection took 9.9890232086182 ms
Query took 3.3938884735107 ms

So that is not blocking.

Any ideas on how to solve that?

Setup:

  • php-fpm7.2
  • nginx
  • symfony3.4

It is been blocked by the PHP Session.

You can't serve to pages that requires access to the same session id.

Although once you close/serve/release the session on the slow page, another page can be served on the same session. On the slow page just call Session::save() as soon as possible on your controller. This will release the session. Take into consideration that everything you do after saving the session will not be stored in the session.

symfony 3.4 FirewallListener Slow / Blocking, symfony 3.4 FirewallListener Slow / Blocking. 316. January 02, 2018, at 9:54 PM. When i´m doing a request to a "huge" page with a lot of data to load, and make  I activated the Profiler and recognized that the FirewallListener was the blocking element). Profiler Screenshots (Loaded huge, switched tab - loaded normal) Huge Normal While the "huge" page was loaded, i did a mysql php request on cli with some time measurements: Connection took 9.9890232086182 ms Query took 3.3938884735107 ms

The reason the firewall takes so long is that of debug is enabled.

In debug, the listeners are all wrapped with debugging listeners. All the information in the Firewall is being profiled and logged.

Try to run the same request with Symfony debug disabled.

symfony 3.4 FirewallListener Slow / Blocking – GiveMeAns – Get the , When i´m doing a request to a "huge" page with a lot of data to load, and make a second request to a "normal" content page, the normal page is  If you are seeing very slow times in the TraceableFirewallListener using HTTP Basic authentication, there's a good chance it's the bcrypt encoder verifying the password on every request. Because there is no session it has to process the password every time, and the processing the the bcrypt and argon2i encoders is deliberately very slow.

We had a similar problem. When sending a couple of consecutive requests to the server in a short period, the server became very slow. I enabled the profiler bar, and a lot of time was spent by the ContextListener

The problem was that file server access on our server is very slow, and session information was stored on the file system, as is the default for symfony.

I configured my app to use the PdoSessionHandler, and the problem was gone.

symfony/symfony, It's about 20 times slower than the average deb traceable-firewall-listener Although I can confirm, that it is better on Symfony 3.4 BETA. v3.4.0-BETA3): Loading from cache Writing lock file Generating autoload files  1 symfony 3.4 FirewallListener Slow / Blocking Dec 19 '18 1 Testing Codeception on Gitlab CI with Selenium service May 20 '19 1 Inheritance with POCO entities in Entity Framework 4 May 25 '12

The Firewall and Authorization (The Security Component, The Firewall and Authorization: Central to the Security component is authorization. This is handled by an instance of AuthorizationCheckerInterface. When all  5 Symfony 4, Twig & VueJS - Redirecting to Symfony routes in Vue component Dec 9 '17 5 symfony 3.4 FirewallListener Slow / Blocking Jan 2 '18 View all questions and answers →

symfony 3.4 FirewallListener Slow / Blocking – 3 Ответа, symfony 3.4 FirewallListener Slow / Blocking. 1. Когда я делаю запрос на "​огромную" страницу с большим количеством загружаемых данных и делаю  How to Use Assetic for Asset Management: Installing and Enabling Assetic Starting from Symfony 2.8, Assetic is no longer included by default in the Symfony Standard Edition.

5 Ways to optimize Symfony Baseline Performance, Even though Symfony is consistently listed as one of the slower PHP frameworks in many simple hello world benchmarks (most notably  Blocking Locks¶. By default, when a lock cannot be acquired, the acquire method returns false immediately. To wait (indefinitely) until the lock can be created, pass true as the argument of the acquire() method.

Comments
  • I would suggest to try to use XDebug profiler to get more detailed picture about request internals
  • The within the Firewall the Contextlistener is that that blocks
  • Thanks! So when a page that requires a session is loaded, a another page (thats not require a session) could not be loaded at the same time if its the same sessionId
  • All Symfony URL inside a firewall requires the session in order to load the token/user and validate that this token/user it is allowed to access to the current firewall. There is cases that this does not apply but it is not the usual case.
  • Can you explain why this should be the case?