blackfire | A minimal , fast and unopinionated web framework for Swift | Web Framework library
kandi X-RAY | blackfire Summary
kandi X-RAY | blackfire Summary
A minimal, fast and unopinionated web framework for Swift
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of blackfire
blackfire Key Features
blackfire Examples and Code Snippets
Community Discussions
Trending Discussions on blackfire
QUESTION
At this moment my codeception tests execute half of hour, and obviously this time grows when I add new tests.
I try to achieve much better performance with my tests because after push I very often simply forget that I pushed something because of slow tests.
At this moment I see that my biggest problem is fixtures. Here very descriptive blackfire profile:
Only loading and unloading fixtures take 93% of the time, but the testing itself takes 5% of the time.
I thought that I could use a single set of fixtures for all my test and just rollback transactions after every test, but I found that with a large number of test cases it is becoming more and more difficult to maintain such data - adding new tests cases always broke some old tests.
So, any solution how can I decrease the time consumed by fixtures? Maybe some way here to use raw SQL dump for each set of tests? Or should I write a huge shell script that restore dumps to the database and run each set of tests separately?
...ANSWER
Answered 2020-Jul-25 at 07:24There is no simple answer to this. Here are a few things that worked for me in the past. Some might not work with your application or maybe doesn't make sense. I hope that here is something useful for you.
Reduce the number of fixtures per test you have to load
Define a set of common data (users, products, whatever you have in your application) that can be used by all tests. It doesn't have to be a "one for all" set. Think more of it as the common denominator. This data should not be modified in your tests or at least not in a way that breaks tests. Load this fixture before running the test suite. In each test, load only the additional fixtures you need for this specific test.
Replace Yii Fixtures
I'm not familiar with Yii, but framework fixture loaders are usually not that efficient. Maybe you would be better off with some own tooling.
Switch to an in-memory database
It's usually a bit to a whole lot faster.
Copy the database
You can reduce the loading time by loading the fixture once, creating a copy of the database and then just reloading it. SQL dumps are one way to achieve this. With SQLite, you can simply create a backup of the database file and copy it back before each test.
If I got you right, you have sets of tests that share the same data. You could create a suite for each set. Add a test listener that loads the fixture and creates the copy before the suite runs and restore the backup before each test.
Unit test the use cases
Not exactly what you asked for, but this will drastically reduce the time needed to run your tests. When you have all your use cases unit tested, you'll need much fewer end-to-end tests. Depending on your architecture this may not be feasible at the moment, but it's never too late to start working towards it.
QUESTION
I'm relatively new to Symfony. I am currently working on a prototype with Symfony & Docker.
Today I implemented an AuthenticationService via Login (like this: https://symfony.com/doc/current/security.html). When I now load my application, the server- response time is around 1500 ms. Without this authentication, the response time is around 70 ms.
I turned on the profiler, and it seems that the "TraceableFirewallListener" takes a lot of time. Symfony Profiler Result I already tried the comman tipps (changing to prod env, disabeling debug).
I don't really have a clue why it is taking that long, but I'm pretty sure that this can't be normal. I also do not want to implement the "solution" from here (TraceableFirewallListener extremely long loading time), since this seems a very bad practice for me.
My security.yaml is below. If you need anything else, please ask me and I will attatch it.
Thanks for the help in advance
UPDATE
Installed blackfire and found some interesting graphs, maybe this will help: https://blackfire.io/profiles/197c3e1c-c53b-4c28-b793-a384fdb90755/graph
...ANSWER
Answered 2020-Mar-27 at 22:29Turns out, it had nothing to to with the Authenticator itself at all. Symfony was not able to use the cache at all, which led to a reconsructing/ rebuilding of the LoginFormAuthenticator every request. The long response time in this case is probably due to the fact that for this service a lot of classes are used and every single one of them is recreated.
The fix for me was 1. adding the 'var' folder to the .dockerignore, so the directory was not copied to the container while building. Secondly I had to remove the mount for the complete 'app' folder (which contained the 'var' folder and the cache inside of it). Dont forget to "remount" the necessary folders. I think the reason why this issue happened in the first place was, I did created the symfony project on my host machine and thought everything has to be inside the container. Seems that this led to no permission for using the cache.
Response times back to ~70 ms
QUESTION
I have a weird problem where a request I make (to my mercure hub) with postman works fine, however the Publisher class (from the Symfony mercure bundle), which uses the Symfony HttpClient will yield in a response code 0. According to my research that means that the URL can't be found, or no Response was returned?
I first thought it might have to do something with the Publisher class itself, which is why opened this Issue on Github, but after some playing around I thought that maybe there is a communication error with my containers? I tried giving my mercure container "networks: internal", which some other containers use aswell, but that didn't help either.
Any ideas are greatly appreciated..
/e: my docker-compose:
...ANSWER
Answered 2020-Feb-17 at 14:59In reference to your comment, your MERCURE_PUBLISH_URL
.env variable must indeed refer to your Mercure container, but there's no need for the port indication. If the name of your Mercure container is "mercure", the environment variable should be set like so :
MERCURE_PUBLISH_URL=http://mercure/.well-known/mercure
(Replace http
by https
if your connection is secured)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install blackfire
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page