cms
cms copied to clipboard
Thousands of events created on collection request when using Telescope
Bug description
Request to Pages collection takes long time and thousands of events generated
I initially noticed this issue after upgrading my install to Statamic 3.3.3 and Laravel 9. Any collection with more than a few pages would take a really long time to load.
TTFB - is how long I see the request took in the Telescope, but the page remains in loading state until the Content Download finishes.
In Telescope same request shows thousands logs, events, cache and redis requests
I am using custom Eloquent driver and wasn't sure if it's connected to that in any way so I have installed a completely fresh version of Statamic and I can see same sort of thing happening with events there. (I didn't add any content, created any blueprints or changed statamic in any way other than install telescope)
How to reproduce
Install fresh copy of statamic as per documentation statamic create $project
.
Add telescope - composer require laravel/telescope
(telescope requires database but I haven't changed any statamic settings)
Open Control Panel and Collections -> Pages
in DevTools you can see the time it takes to load this page with just one page
in Telescope -> Requests - you can see the number for events that one request generated
Logs
No response
Versions
Statamic 3.3.4 Solo Laravel 9.6.0 PHP 8.1.3 No addons installed
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
No response
Additional details
No response
I am using custom Eloquent driver
Your own? Or https://github.com/statamic/eloquent-driver ?
@jasonvarga it's basically the same with small modifications for our own needs (we're using multiple models) - but the issue with events is replicated on a clean statamic install without eloquent-driver.
Thanks for the excellent write-up, @elijahworkz . I checked my own Telescope logs to see if the behavior was the same and indeed it was. In a collection with only a couple dozen entries, the request to load the index was generating 14156 events.
That's a lot. 😬 I'll dive into this soon!
I have the same issue as @elijahworkz with Statamic 3.3.4 and Laravel 9.0
I installed new project using statamic create $project
and installed telescope nothing more.
Page list request is taking long time as well.
In telescope request looks like:
Thanks, there's enough info here. 🤘
Okay so I have enabled Laravel Debugbar and turned on the events collector. I load a collection, and see the number of events are reasonable.
Install Telescope, refresh, and the number of events in debugbar skyrocket.
Remove telescope, the events drop back down.
So, it's an issue with Telescope.
We can address it, but just letting you know that it's not going to be happening without Telescope running, if you need a workaround. Even just adding TELESCOPE_ENABLED=false
to your .env
should result in the number of events and load times to drop.
@jasonvarga I can confirm that adding TELESCOPE_ENABLED=false
solves the load speed issue (is it normal that I didn't have to run php artisan config:clear
- it seems it was automatically picked up?!)
Thanks! We can use it as temporary solution, but it would be great to have statamic 3.3.* play nicely with telescope
Laravel Telescope is a standard so it would be great for Statamic to work with. Additionally, it worked in previous versions.
Thanks, @jasonvarga ! That solved it for me, too! I guess that probably closes #5561 , then.
Laravel Telescope is a standard so it would be great for Statamic to work with. Additionally, it worked in previous versions.
Absolutely. I'm just suggesting a workaround.
Any updates on this issue? I've just updated to the latest version of statamic (3.3.16) and the issue is still there - with Telescope enabled it takes a long time to load any collection index page. As soon as I disable telescope - it loads very fast again.
We are experiencing this issue as well. Some pages, especially pages that render collection listings (ie Blog) are returning a 504 error.
I've found a "sort of fix". Currently having the same issue on my site. The solution is not perfect but worked for me. Instead of disabling Telescope. Go into the telescope config, and disable event, and gate watching. The speed has now dramatically increased, and I've still got the most important logging with Telescope.
config/telescope.php
Thanks @JesperFiltenborg, unfortunately the main reason why I installed this package was for the event/queue watcher. Overall, this does seem promising.
This is the first time somebody deleted my comment on GitHub.
It was a polite and relevant feedback from a customer of two years who finds it difficult that such issues still exist.
It is odd that the removal of my comment is the first reaction from Statamic regarding this issue.
Wouldn’t it be more appropriate to address the issues that’s been existing for almost a year?
@jtomek I feel you. I've experienced frustrations around these kinds of issues, too.
But, to be fair, this is the case with nearly every software product. And, issues arising from integration with third-party tools like Laravel Telescope—while important—I could see being lower priority than core upgrades or improvements.
So, while I'm not sure deleting your comment was fair, as a neutral observer, I felt like your post might've sounded more hostile and unreasonable than you were thinking it was. At least in a GitHub issue thread.
I think your thoughts would be totally appropriate in a blog post or forum post, though. It's useful feedback that I'd hope the Statamic team is taking to heart, even if they don't have the resources to address these specific problems currently.
@jtomek wow - I didn't realize it's been almost a year since I opened this issue....
Since then we developed our own admin system :) (nothing against statamic - its great for what it does but it required too many modifications to fit our needs anyways and waiting on fixes... well, it seemed simpler to create something custom fit... )
So, while the issue is no longer relevant to me - it might be helpful for others...
I don't think that comment should have been deleted, FWIW. Feedback is fine, even if negative. It didn't seem overly hostile to me.
(For context, since it was deleted, the comment said something about some other platform they switched to.)
I just ran into this exact issue with two Statamic 4.42.0 projects. Both projects have Telescope installed. The Pages tree wouldn't load when I added a Linkfield to the homepage and added a link to any entry in the same tree.
As @JesperFiltenborg mentioned, disabling the event and gate watchers "fixed" this issue.