Comments (18)
Kindly pinging :)
from photonlibos.
Yes, Photon coroutines can satisfy your requirements. Every resource is located in a single thread and shared among coroutines. You can read the documents for more details.
from photonlibos.
Linux thread is referred to as vCPU in Photon. Each of them has a dedicated scheduler for coroutines (Photon's threads), and a dedicated instance of event engine (e.g. epoll or io_uring). Their execution is basically independent of each other, unless you conduct inter-vCPU task coordination or migration.
from photonlibos.
You can realize interrupt affinity in the same way you do to other applications, e.g. pinning interrupt handler and corresponding photon vCPU (Linux thread) to the same physical CPU core.
from photonlibos.
What would you recommend to separate CPU and IO-bound jobs in the programming models? As far as I know, coroutines are for IO-bound jobs.
from photonlibos.
You can use the migrate API to move your CPU bound tasks to specific vCPU. Itβs lightweight
from photonlibos.
What would you recommend for Interprocessor communication if shared memory is absolutely no?
from photonlibos.
Is it a Photon related issue?
from photonlibos.
Already appreciate your answers so I apologize if it sounds unrelated. I am evaluating and comparing Photon with Seastar. Trying to map approaches in Seastar to Photon.
For example, In Seastar, it is mostly done by passing a lambda to a neighbor VCPU. I was wondering what do you think is a best approach to take as communication between VCPUs.
from photonlibos.
A Photon thread (coroutine) is essentially a function. Lambda is also the same.
The underlay implementation of thread migrate is eventfd notification and task queue.
Besides Photon also has a MPMC queue to transmit functions, encapsulated as the so-called WorkPool
from photonlibos.
I've searched the code, how about use sched_setaffinity
(linux)/thread_policy_set
(macos) to bind vCPU to a single CPU core? @beef9999
from photonlibos.
@loongs-zhang Are you suggesting that we bind vCPU by default?
from photonlibos.
What would you recommend for Interprocessor communication if shared memory is absolutely no?
Multi-process without sharing memory? How about UNIX domain socket?
from photonlibos.
@loongs-zhang Are you suggesting that we bind vCPU by default?
yes
from photonlibos.
What would you recommend for Interprocessor communication if shared memory is absolutely no?
Multi-process without sharing memory? How about UNIX domain socket?
How about deep cloning and sharing?
from photonlibos.
@loongs-zhang Are you suggesting that we bind vCPU by default?
yes
As different apps require different binding configuration, it's difficult for us to do it by default.
For example, a typical scenario is file/storage server. We may need to consider IRQ handlers of the NICs and SSDs, and our service threads (vCPUs). The best binding configuration should minimize CPU switching along the execution.
from photonlibos.
How about deep cloning and sharing?
I not sure whether cloning is feasible, as it may imply sharing in the first place, and @kosav7r said it was "absolutely no".
from photonlibos.
What would you recommend to separate CPU and IO-bound jobs in the programming models? As far as I know, coroutines are for IO-bound jobs.
Photon has a built-in WorkPool
to deal with various kinds of background jobs. For IO-bound ones, you can initialize the worker vCPUs to enable coroutines and event engines. For CPU-bound ones, you can simple use kernel threads without initializing photon.
BTW, the jobs are efficiently passed to workers with lock-free shared memory ring queue.
from photonlibos.
Related Issues (20)
- install option via cmake? HOT 3
- Issue building on Ubuntu/ARM HOT 11
- [Discussion] Add ENABLE_TLS option HOT 2
- Build fails on fresh Ubuntu 23.04, GCC-13 HOT 11
- Pinning Photon vcpu to specific cpu cores HOT 5
- It would be great if it supports various clients, such as grpc, redis, mysql.. HOT 5
- - HOT 1
- Windows IOCP backend support HOT 4
- EPOLL: Why not set EPOLLONESHOT in add_interest when ONESHOT is set? HOT 4
- Scalable Stack Discuss HOT 4
- Clarification on Lock and Synchronization HOT 19
- build with curl 8.2.1 failed, some macros are deprecated.
- Unit test with lockfree queue `PhotonLockfreeBatchMPMCQueue+Batch` reported mismatch.
- Example for RDMA HOT 2
- TLS implementation does not validate certificate chain HOT 2
- Will it support system API hooks in the future? For example, sleep, connect, recv, etc. HOT 2
- Support customized UserAgent in Http HOT 1
- examples/perf/io-perf fails with segmentation fault with io-uring: HOT 1
- Reducing default stack size from 8 MB to 8 KB - is it possible? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from photonlibos.