Remove `opcache_invalidate()`
Fix #134
Feels sketch to just delete code we have here presumably for a reason?
@taylorotwell
As mentioned in #134, the opcache_invalidate() function leads to a gradual increase in memory usage over time. This issue can be easily reproduced with a stress test on any Livewire Volt project with opcache enabled.
ab -n 10000 -c 20 http://localhost:8016/
The red line in the chat represents a Livewire Volt project. It is a zero-traffic website, yet the memory usage increases simply by pinging it every 60 seconds (as part of an uptime monitor).
This opcache_invalidate() function was introduced in the early stages of this package to address a scenario that no longer exists. Probably @nunomaduro can confirm this.
An older issue that led to the addition of opcache_invalidate(): https://github.com/livewire/volt/issues/25. The documentation no longer references this type of usage. It was probably available at that time.
Here is the 1 hour chart when I remove opcache_invalidate():
But that scenario does still exist and is still supported, so this would break those situations, so it's ideal we find some way to solve the memory issue without breaking applications that use multiple named Volt components per page.
@taylorotwell
Ouch! I understand now; I just saw it in the Volt Functional API.
I'm surprised that no one in the community has noticed this issue regarding memory usage. I will look for alternatives to address this.
Unfortunately, I've realized that I lack sufficient expertise with the Volt codebase to propose a solution. I hope someone more knowledgeable than I can figure it out. Sorry.
Unfortunately, I've realized that I lack sufficient expertise with the Volt codebase to propose a solution. I hope someone more knowledgeable than I can figure it out. Sorry.
@robsontenorio does the memory usage increase over time or only with usage? As in does it go back down when traffic subsides?
@inmanturbo
It increases over time when rendering Livewire Volt components.
I noticed this issue because my landing page has 8 different Livewire components.
And my uptime monitor (60secs) makes a call to it.
The memory usage never go back to the original state , it always increase a little bit.
Did you notice this issue ?