PhotonLibOS icon indicating copy to clipboard operation
PhotonLibOS copied to clipboard

question: how to use multi-core when writing applications with photonlibos

Open cllh opened this issue 3 years ago • 9 comments
trafficstars

Looks like photonlibos can only use one CPU core. If I want to write a service running on a multi-core server, how can I use all of the cores?

Can you give an example?

cllh avatar Jul 25 '22 08:07 cllh

@cllh @jiangdongzi Photon v0.2.0 has released.
Now we have a more elegant way to enable muti-vcpu scheduling. Please see the echo server test example.

./net-perf -vcpu_num 8

beef9999 avatar Jul 25 '22 11:07 beef9999

awesome, looking forwards to the full automatic coroutine scheduling enhancement like golang.

when will this feature be available?

cllh avatar Jul 25 '22 15:07 cllh

Note this is not the ultimate version of multi-core support, the full automatic coroutine scheduling like Golang did (also called task stealing) Does this mean at current time, one certain coroutine can be only scheduled by one certain thread?

jiangdongzi avatar Jul 27 '22 13:07 jiangdongzi

thread_migrate allows you to migrate one coroutine from one vcpu to another. (vcpu = OS thread)

Besides, you can use thread/workerpool.h. It's also a multi-thread implementation.

beef9999 avatar Jul 27 '22 14:07 beef9999

I can achieve 2.4M QPS by running this modified example, with the CPU usage of 800%.

beef9999 avatar Jul 27 '22 14:07 beef9999

awesome, looking forwards to the full automatic coroutine scheduling enhancement like golang.

when will this feature be available?

The development of work-stealing has already started, and might be finished by this autumn, but there's no hard deadline.

lihuiba avatar Jul 29 '22 09:07 lihuiba

awesome, looking forwards to the full automatic coroutine scheduling enhancement like golang. when will this feature be available?

The development of work-stealing has already started, and might be finished by this autumn, but there's no hard deadline.

Well, I want to know when will you release detailed document?

jiangdongzi avatar Jul 29 '22 11:07 jiangdongzi

awesome, looking forwards to the full automatic coroutine scheduling enhancement like golang. when will this feature be available?

The development of work-stealing has already started, and might be finished by this autumn, but there's no hard deadline.

Well, I want to know when will you release detailed document?

Currently we are focused on completing the feature set.

Please read the header files (and possibly some cpp files) for reference, for now.

lihuiba avatar Aug 01 '22 05:08 lihuiba

awesome, looking forwards to the full automatic coroutine scheduling enhancement like golang. when will this feature be available?

The development of work-stealing has already started, and might be finished by this autumn, but there's no hard deadline.

Well, I want to know when will you release detailed document?

And we'll write detailed document later, when major features are implemented and their interfaces get stable.

lihuiba avatar Aug 01 '22 06:08 lihuiba