volt icon indicating copy to clipboard operation
volt copied to clipboard

Remove `opcache_invalidate()`

Open robsontenorio opened this issue 7 months ago • 7 comments

Fix #134

robsontenorio avatar May 15 '25 14:05 robsontenorio

Feels sketch to just delete code we have here presumably for a reason?

taylorotwell avatar May 15 '25 15:05 taylorotwell

@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).

image

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():

image

robsontenorio avatar May 15 '25 15:05 robsontenorio

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 avatar May 20 '25 15:05 taylorotwell

@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.

robsontenorio avatar May 20 '25 17:05 robsontenorio

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 avatar May 22 '25 14:05 robsontenorio

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 avatar May 22 '25 15:05 inmanturbo

@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 ?

robsontenorio avatar May 27 '25 12:05 robsontenorio