Skip to content

Remove opcache_invalidate() #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

robsontenorio
Copy link
Contributor

Fix #134

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@taylorotwell
Copy link
Collaborator

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

@taylorotwell taylorotwell marked this pull request as draft May 15, 2025 15:08
@robsontenorio
Copy link
Contributor Author

robsontenorio commented May 15, 2025

@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(): #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 robsontenorio marked this pull request as ready for review May 20, 2025 01:19
@taylorotwell
Copy link
Collaborator

taylorotwell commented May 20, 2025

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.

@robsontenorio
Copy link
Contributor Author

@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 robsontenorio marked this pull request as draft May 20, 2025 17:59
@robsontenorio
Copy link
Contributor Author

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.

@inmanturbo
Copy link

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?

@robsontenorio
Copy link
Contributor Author

robsontenorio commented May 27, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

opcache_invalidate is not safe under high concurrencies
3 participants