Very long "Router Dispatch" in Clockwork with Laravel 4 on localhost - laravel

I've got a Laravel app setup locally with (what seems to me) very poor performance as you can see below:
My setup:
W8 on a pretty fast laptop with SSD
XAMPP 3.2.1
Laravel 4.1.*
Clockwork 1.* (only added the controller event as desribed in the docs)
Debug mode true
The scenario described:
A logged in user access a page with a list of prospects : 1216ms
Then the user logs out : 1164ms
Finally the user is redirected to the login page : 1165ms
As you can see in every single request the bottleneck is the "Router Dispatch" event. What can I do to dig further, and most importantly what can I do to improve its duration?
Or maybe because this is a dev environnment these are expected numbers? (I don't believe so, but I might be wrong).

After updating my XAMPP to the latest and Laravel to 4.2, this just got fixed by itself.

Related

How to disabled Phusion Passenger for hosting on Plesk? When I refresh web app in VueJS I always have error

My server has Plesk and I have mydomain.com with frontend in Vue and backend in api.mydomain.com with laravel. Before, when I went to mydomain.com/clients and tried to refresh the page, I got an error with Phusion Passenger. I have disabled Phusion Passenger on this domain but I don't remember how I did it.
Now, I have the same problem with the same front and back system. The only difference is that both domains are subdomains, that is, I have front.domain.es and api.domain.es.
If I refresh front.domain.com it works perfectly. If I navigate from the system menu it works fine. But, if I am in front.domain.com/clients for example and I try to refresh page, I get Pushion Passenger error.
Important comment that the system work perfectly, just when you try to refresh the page has this error. On the first example that I comment, now works perfecty without Passenger, I can refresh without problem, but I don't remember how I did it.
I want to disable Phusion Passenger for this hosting on plesk or domain or whatever, I hope you can help me!
Thank you very much!!
Log File:
[ E 2023-02-02 08:44:42.0486 476333/Tf age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/www/vhosts/domain.com/front.domain.com: The application process exited prematurely.
Error ID: dbcc318c
Error details saved to: /tmp/passenger-error-BX09me.html
Go in Tools&Settings >> PHP Setting
In top of the page you should find this " Select the PHP handlers you want to make available. You can install additional handlers using the Plesk Installer. "
Follow the link and will take you to Plesk Installer, there you can enable/disable modules including fusion

Laravel app is very slow - over 3 seconds to boot and 2 seconds to load

The app is not even big,but it takes over 5 seconds to reload some pages,i don't think that is normal eventhough I read that laravel is pretty slow,but this is unusable,I've installed debugbar and it is showing that booting takes over 3.5 seconds while loading of the app is over 2.5 seconds,I've been following a course and instructor's app loads instantly,can someone tell me what effects the booting and load time?
Since this is a general question without specific detail here's a general answer:
Your first step should be to install the Laravel debug bar (which you say you have) and then look at the query time or controller time and narrow down the culprit. Based on that, you can ask more pointed questions on StackOverflow with the details of the specific queries that are slow, or if it's a controller that's slow, you can post the contents of that controller file. From there we can make recommendations in terms of what changes you can make.
One other thing to try is on the same machine try out a vanilla Laravel app and see what the baseline load times are. Maybe there's nothing wrong with your app at all and instead it has something to do with whatever is serving it.
Alright,I think I've got it fixed,was using XDebug for PHP lectures for collage and that is why app was running so slowly,so I've disabled it.
If anyone else will have similar problem here is the solution,but be aware that this will disable your xDebug:
Open XAMMP -> Click on config button for Apache -> Open PHP (php.ini).
Inside of that file look for "[xDebug]" and comment out all the commands that enable it ( in front of commands put ";" and space (" ") ) . It should look like this:
; [xDebug]
; zend_extension = C:\xampp\php\ext\php_xdebug-2.9.8-7.2-vc15-x86_64.dll
; xdebug.remote_enable = 1
; xdebug.remote_autostart=on
And then restart the server
If you need xDebug,then check out this post - PHP on Windows with XAMPP running 100 times too slow

how to debug during API with laravel

I run my laravel app #localhost.
```php artisan serve --host=localhostIP```
On top I run an Andoid app with the same base URL.
Could anyone tell me how can I debug incoming API´s calls
like if BASEURL/users is called?
Furthermore, how can I log the happening events in the console
I am developing API's with laravel too, i do it this way:
composer require laravel/homestead to have it all in a vm 😉 see https://laravel.com/docs/master/homestead for more information, i use the "per project" installation
Download postman to have the best tool for sending querys to your api and to test your api quick -> https://www.getpostman.com (i use it free)
configure and run your homestead (it's not that complicated).
your homestead is fit with php and xdebug enabled
i am using phpStorm and have my vagrant setup as deployment target
"listen to debug" with phpstorm
to your GET requests, add a queryparam XDEBUG_SESSION_START=PHPSTORM
i can debug my api now 😉
i also wrote https://logcrawler.de to receive the log informations of all my api's and all my server 🤩
I hope, i could help you a little bit
This is my way, but I think it's not good!
Create router api in config/web, Eg:
router/api: Route::post('/check_api', [CheckController::class, 'testFunc'])->name('api.check_api');
web/api: Route::post('test/check_api', [CheckController::class, 'testFunc'])->name('test.check_api');
Create a post by form or ajax in one resource/view like index
Go to page, and debug with phpstorm
You can use logging feature of Laravel. Apply Logs on entry point of application to test whether API url is hitting or not.
use postman
https://www.getpostman.com/downloads/
it's an excellent thing very much usefull

Error 404 for rest webservice request in offline app in GeneXus Ev3 U9

I'm developing an offline Android app with Genexus Ev3 U9 and when I try the app in the device I see there is no initial synchronization, even when I try to execute a manual sync the app shuts down. The cat log shows that request made to URLs like http://192.168.12.17/MyAppSmartDevicesEnvironment/gxmetadata/MyApp.android.json
worked fine but when the app tries to get this URL http://192.168.12.17/MyAppSmartDevicesEnvironment/rest/MyAppOfflineDatabase?fmt=json&event=gxchecksync returns 404 I tried the same link in my laptop and it's like the requested resource was not created by GeneXus.
What could be wrong?
There are actually a couple of things you might want to check.
When you accessed http://192.168.12.17/MyAppSmartDevicesEnvironment/gxmetadata/MyApp.android.json you got data but that just means that the virtual directory was successfully created. (which is good of course)
Then you need to check if the WCF module is installed correctly, in order to do that you could try to go to http://192.168.12.17/MyAppSmartDevicesEnvironment/MyAppOfflineDatabase.svc/rest or any other service in your KB. That goes straight to the service implementation. (you can check you web.config file in order to see the actual rewriting rules)
If that works it's certainly a URL Rewrite problem like Sandro and Guscarr suggested.
You can download and install the module from here: http://www.iis.net/downloads/microsoft/url-rewrite
Gcastano,
It seems that you're generating to .net, right?
If so, it could be some problem with iis rewrite module.
Anyway you might check gx software requirements...
It seems that REST services cannot be run on your IIS, as Sandro said, try installing URLRewrite.
Further info at http://wiki.genexus.com/commwiki/servlet/wiki?14575,Android%20-%20FAQ%20and%20Common%20Issues

How do I use Redis to communicate between my API and the socket server (Angular2/Laravel)

I'm using:
- Laravel as my backend
- Angular 2 as my frontend
I'm trying to show all connected users to my website real time information using Laravel,Angular 2 and Redis.
I installed redis for windows: https://github.com/rgl/redis/downloads
Played with it a little:
But I have no idea where to go from here, couldn't find any instructions or help about using redis with angular2/laravel, and I hope you can help me.
My first goal is simple: Update a variable for all connected users in my app.
For example:
- user clicks a button
- another user who connected to the website can see "Someone clicked this button!" without refreshing the page
How I can make it with the current technology I use (Angular2/Laravel)? (If there is something else than a redis, it's fine)

Resources