Skip to content

Swoole fix setAffinity call on Mac#327

Merged
andrewdalpino merged 1 commit into
RubixML:2.5from
mcharytoniuk:swoole-fix-affinity
May 6, 2024
Merged

Swoole fix setAffinity call on Mac#327
andrewdalpino merged 1 commit into
RubixML:2.5from
mcharytoniuk:swoole-fix-affinity

Conversation

@mcharytoniuk
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Member

@andrewdalpino andrewdalpino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just wanted to confirm a couple things before we merge. See comment

Comment thread src/Backends/Swoole.php

$workerProcess->setAffinity([$currentCpu]);
if (method_exists($workerProcess, 'setAffinity')) {
$workerProcess->setAffinity([$currentCpu]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this looks like it's telling the worker process to bind to a particular unit. Is that right? Does this provide some performance enhancement? Does it still work as intended without setting the CPU affinity?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does work as intended; yeah it will be slower on mac because I think it will cause more context switching.

I added that on top of the other changes, so it wasn't the primary driver behind the performance gains.

@andrewdalpino andrewdalpino merged commit 274076c into RubixML:2.5 May 6, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants