Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multicore version of Lwt_preemptive #1

Merged
merged 13 commits into from
Sep 29, 2020
Merged

Conversation

Sudha247
Copy link
Owner

@Sudha247 Sudha247 commented Sep 7, 2020

No description provided.

Sudha247 and others added 6 commits September 1, 2020 13:42
It is used internally to implement system_limit, which already returns
int option.

There is no behaviour change.
IOV_MAX is optional in POSIX [1], so it is not defined if the OS does
not specify an actual limit. Hence, make lwt_unix_iov_max simply return
None, as it is handled already by the callers.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
if worker.reuse then worker_loop worker
match C.recv worker.task_chan with
| Task (id, task) ->
task ();
Copy link

@shubhamkumar13 shubhamkumar13 Sep 8, 2020

Choose a reason for hiding this comment

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

Isn't the task type here a result type? There should be a pattern match here right?

Copy link
Owner Author

Choose a reason for hiding this comment

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

task here is the function that's supposed to be executed. The task doesn't return the result, but it stores it elsewhere in the detach function.

task_cell = CELL.make ();
thread = Thread.self ();
reuse = true;
task_chan = C.make_bounded 0;

Choose a reason for hiding this comment

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

I'm a little confused since I'm not aware of the internal workings but initializing the channel bound as zero, isn't that equivalent to a synchronous channel? -> https://github.com/ocaml-multicore/domainslib/blob/2ac25c7a207e199281f702560e20f3e7c4069088/lib/chan.ml#L27

Copy link
Owner Author

Choose a reason for hiding this comment

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

It is indeed a synchronous channel. Since we are going to send only one task at a time to this channel, shouldn't really matter for performance. If we do see some impact in the performance, we can increase the buffer size.

@Sudha247
Copy link
Owner Author

Sudha247 commented Sep 28, 2020

Some performance numbers for a benchmark that uses Multicore version of Lwt_preemptive is below. The benchmark server and client code can be found here.

Number of clients: 10
Requests per client: 10

Cores Time
1 14m52.014s
2 7m26.023s
3 5m21.133s
4 4m9.774s
5 4m9.769s
6 4m0.854s
7 3m51.936s
8 3m43.021s

@Sudha247 Sudha247 merged commit 792f619 into master Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants