Giter Site home page Giter Site logo

Comments (12)

bpolaszek avatar bpolaszek commented on June 6, 2024

Hi @progmancod,

Thank you for spotting this! It makes sense indeed.

Problem is, Framework X doesn't seem to expose the Connection object, meaning we have no means to get notified when the connection closes. I'll try to get some help over there.

from freddie.

bpolaszek avatar bpolaszek commented on June 6, 2024

Wait, after a coffee ☕ I think I found another way to address this, as the stream exposes a close event itself.
Can you please have a look at this and maybe try on your side?

from freddie.

progmancod avatar progmancod commented on June 6, 2024

With 2 thousand users connected, after a few hours, freddie mercure continues to degrade performance. Maybe just hearing the "close" event of the "stream" is not enough in some scenarios. I'm concerned about the "error" and "end" scenarios.. Let's see the docs (https://github.com/reactphp/stream):

  • The error event will be emitted once a fatal error occurs, usually while trying to read from this stream.

  • The end event will be emitted once the source stream has successfully reached the end of the stream (EOF).

  • The close event will be emitted once the stream closes (terminates).

  • After the stream errors, it MUST close the stream and SHOULD thus be followed by a close event (OK)

  • Many common streams (such as a TCP/IP connection or a file-based stream) will likely choose to emit this (close) event after reading a successful end event or after a fatal transmission error event. (Maybe the problem? will likely choose to emit?)

from freddie.

bpolaszek avatar bpolaszek commented on June 6, 2024

Oh, that's bad news 🙁

Unfortunately, I'm quite overwhelmed these days, and I don't even have the time to perform a stress test.
I'll try to look at this ASAP, but I couldn't give any ETA at the moment.

from freddie.

progmancod avatar progmancod commented on June 6, 2024

No problem, I'm trying to resolve the issue.

from freddie.

bpolaszek avatar bpolaszek commented on June 6, 2024

Hey @progmancod - it's been a while this issue has been opened, and I wanted to make sure everything's now fine. I'm running Freddie on an intensive IoT platform (using Redis) and it can run during months without blinking an eye.

Do you mind if I close that issue?

from freddie.

progmancod avatar progmancod commented on June 6, 2024

Unfortunately, the problem persists in our application. There are about 200 million posts per day, and within a few days, degradation occurs, forcing us to recycle the application. This change has helped a lot, tripling the time it takes for degradation to happen. But there's still some scenario I couldn't find:

$stream->on('close', fn() => $this->hub->unsubscribe($subscriber, 'close'));
$stream->on('end', fn() => $this->hub->unsubscribe($subscriber, 'end'));
$stream->on('error', fn() => $this->hub->unsubscribe($subscriber, 'error'));

from freddie.

SimonFrings avatar SimonFrings commented on June 6, 2024

Hey @progmancod and @bpolaszek, I'm one of the maintainer of ReactPHP and Framework X and we recently received a ticket in ReactPHP's HTTP component, which sounds a little bit similar to the problem described hear (not 100% sure if it's related though). The problem was that the connection close handler wasn't cleaned up properly for each request, resulting in some memory growth.

This issue got fixed through reactphp/http#515 and was already released with reactphp/http v1.10.0. Like I said, I'm not sure if this is the same issue described in here, does the problem still persist with the new changes?

from freddie.

progmancod avatar progmancod commented on June 6, 2024

Unfortunately, the problem persists, and we have given up on using the library in production after spending many hours investigating. Our application receives millions of hits per day, and performance degrades after a few hours. We have reverted to using the original library in Go.

from freddie.

bpolaszek avatar bpolaszek commented on June 6, 2024

Hi @progmancod, no worries.
When you speak about performance degradation, what do you mean exactly? Memory leaks? High response times? Hub not responding?

from freddie.

progmancod avatar progmancod commented on June 6, 2024

The memory increases slightly over time, but the main symptom is an ever-increasing slowness, until it becomes impractical under high demand.

from freddie.

SimonFrings avatar SimonFrings commented on June 6, 2024

The memory increases slightly over time, but the main symptom is an ever-increasing slowness, until it becomes impractical under high demand.

@progmancod Hm, when these performance degradation occur, do you see any high CPU or RAM usage or anything similar? We're currently not aware of anything like this in ReactPHP or Framework X, but we need a way to reproduce this in order to find out which project is responsible for this behavior and what a fix could look like.

FYI: Together with @clue, we have helped others with similar problems in the past. So if you're interested, you can drop us an email and we can set up a quick consulting call to take a look at this together.

from freddie.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.