Skip to content

[Performance] Long polling with mysql during a periodic interval #198

Open
@lucascesconetto

Description

@lucascesconetto

I need to do a long polling, while handling an http request from a client of my API, to give an adequate response.

Until this data is provisioned by a CDC flow from Kafka to my database, the application does long polling at periodic ReactPHP intervals in my database using your mysql client.

I would like suggestions on how I can optimize this flow of many queries in my database, what is the best way to configure your mysql client so as not to generate bottlenecks in my database or in my application?

The Application runs in multiple containers.

Thank you for suggestions!

Example:

private function startPolling(string $id): TimerInterface
    {
        return $this->loop->addPeriodicTimer(
            interval: $this->pollingConfig->getPeriodicTimerInterval(),
            callback: function () use ($id) {
                $task = $this->asyncListenerDao->find(id: $id);
                $this->asyncTaskManager->run(task: $task, completionRule: new RuleExecutable(),  canceller: fn() => null);
            }
        );
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions