Comments (2)
an add - sometimes it is just ONE thread for all connections
[vibe-10(nijw) INF] WORKER :: thread-id=Tid(7fdcc4e82c60) caller=7FDCC4E6D400:2 channel-id=2-fibonacci THREAD=vibe-10
[vibe-10(oxzy) INF] WORKER :: thread-id=Tid(7fdcc4e82dc0) caller=7FDCC4E5F800:2 channel-id=3-fibonacci THREAD=vibe-10
[vibe-10(orNI) INF] WORKER :: thread-id=Tid(7fdcc4e82e70) caller=7FDCC4E6D200:2 channel-id=1-fibonacci THREAD=vibe-10
[vibe-10(ofz5) INF] WORKER :: thread-id=Tid(7fdcc4e82f20) caller=7FDCC4E5FA00:29 channel-id=0-fibonacci THREAD=vibe-10
from vibe.d.
Worker tasks are processed by a fixed set of threads on a first-come-first-serve basis. By default, the number of threads matches the number of logical CPU cores of the system, but this can be customized at startup using vibe.core.core.setupWorkerThreads
.
This is generally the most efficient way to handle such workloads, since it avoids the thread creation and resource overhead for a one-task-to-one-thread mapping. But especially if the workloads have a very different duration, this can indeed have the drawback of a non-optimal distribution across threads - and you also need to call vibe.core.core.yield
periodically to ensure quasi-parallel processing of tasks within the same thread.
But if you really need one thread per task, instead of runWorkerTask
, you can simply create a new Thread
and perform the work directly, without any task involved. vibe.core.channel.Channel!T
together with a free-list could be used to reuse threads and avoid the creation overhead.
from vibe.d.
Related Issues (20)
- Is it possible to add GDC compiler? HOT 1
- MongoDB latest version not working HOT 14
- Bug: registerWebInterface option 'ignoreTrailingSlash' causes redirect to absolute URL, breaking reverse-proxies HOT 4
- WebSocket segfaults if connection to server drops out HOT 7
- WebSocket connected() crashing HOT 12
- Can't build on (AWS ?) Linux HOT 3
- Unable to call the get method from the request form HOT 2
- Getting and sending JSON correctly HOT 1
- [Bug] Unable to call WebSocket.request._query.get() due to const HOT 1
- [CLOSED] How to deal with generated code via preBuildCommands? HOT 1
- Error when building on Raspberry Pi HOT 1
- notls has no effect
- build fails linking ssl - mac HOT 1
- Any way to write headers after response handler returns? HOT 2
- [vibe.d] WebSocket mess with "cast(shared) ..." HOT 1
- Access log is pretty useless for vibe server behind a proxy HOT 3
- Proposal: remove whole Meson support at all HOT 11
- Regression #249 - failed to listen to address with default
- Invalid character in internet path. HOT 6
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 vibe.d.