You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Fortunately Daniel Spiewak had the fantastic insight that the “dummy runtime” which I created to initially cross-build Cats Effect for Native could be reformulated into a legitimate event loop implementation by extending it with the capability to “poll” for I/O events: a <code>PollingExecutorScheduler</code>.</p>
133
133
<p>The <ahref="https://github.com/typelevel/cats-effect/blob/7ca03db50342773a79a01ecf137d953408ac6b1d/core/native/src/main/scala/cats/effect/unsafe/PollingExecutorScheduler.scala"><code>PollingExecutorScheduler</code></a> implements both <ahref="https://www.scala-lang.org/api/2.13.8/scala/concurrent/ExecutionContext.html"><code>ExecutionContext</code></a> and <ahref="https://github.com/typelevel/cats-effect/blob/236a0db0e95be829de34d7a8e3c06914738b7b06/core/shared/src/main/scala/cats/effect/unsafe/Scheduler.scala"><code>Scheduler</code></a> and maintains two queues:</p>
134
134
<ul>
135
-
<li>a queue of tasks (read: fibers) to execute</li>
135
+
<li>a queue of tasks (read: fibers) to execute</li>
136
136
<li>a priority queue of timers (read: <code>IO.sleep(...)</code>), sorted by expiration</li>
<p>After creating an epoll instance (identified by a file descriptor) we can register sockets (also identified by file descriptors) with <code>epoll_ctl</code>. Typically we will register to be notified of the “read-ready” (<code>EPOLLIN</code>) and “write-ready” (<code>EPOLLOUT</code>) events on that socket. Finally, the actual polling is implemented with <code>epoll_wait</code>, which sleeps until the next I/O event is ready or the <code>timeout</code> expires. Thus we can use it to implement a <code>PollingExecutorScheduler</code>.</p>
175
175
<p>As previously mentioned, these sorts of polling APIs are ubiquitous and not just for working directly with sockets. For example, <ahref="https://curl.se/libcurl/">libcurl</a> (the C library behind the well-known CLI) exposes a function for polling for I/O on all ongoing HTTP requests.</p>
<p>Please try the Typelevel Native stack! And even better deploy it, and do so loudly!</p>
210
210
<p>Besides that, here is a brain-dump of project ideas and existing projects that would love contributors. I am happy to help folks get started on any of these, or ideas of your own!</p>
211
-
<ul>
212
-
<li>Creating example applications, templates, and tutorials:</li>
213
-
</ul>
214
-
<ul>
215
-
<li>If you are short on inspiration, try cross-building existing examples such as <ahref="https://github.com/typelevel/fs2-chat/">fs2-chat</a>, <ahref="https://github.com/djspiewak/kitteh-redis">kitteh-redis</a>, <ahref="https://github.com/keynmol/jobby/">Jobby</a>.</li>
216
-
</ul>
217
211
<ul>
218
212
<li>
219
-
<p>Spread the word: <ahref="https://youforgotapercentagesignoracolon.com/">you-forgot-a-percentage-sign-or-a-colon</a>.</p>
213
+
<p>Creating example applications, templates, and tutorials:</p>
214
+
<ul>
215
+
<li>If you are short on inspiration, try cross-building existing examples such as <ahref="https://github.com/typelevel/fs2-chat/">fs2-chat</a>, <ahref="https://github.com/djspiewak/kitteh-redis">kitteh-redis</a>, <ahref="https://github.com/keynmol/jobby/">Jobby</a>.</li>
216
+
<li>Spread the word: <ahref="https://youforgotapercentagesignoracolon.com/">you-forgot-a-percentage-sign-or-a-colon</a>.</li>
217
+
</ul>
220
218
</li>
221
219
<li>
222
220
<p>Cross-building existing libraries and developing new, Typelevel-stack ones:</p>
223
-
</li>
224
-
</ul>
225
-
<ul>
226
-
<li>Go <ahref="https://github.com/typelevel/feral">feral</a> and implement a pure Scala <ahref="https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html">custom AWS Lambda runtime</a> that cross-builds for Native.</li>
227
-
</ul>
228
-
<ul>
229
-
<li>A pure Scala <ahref="https://grpc.io/">gRPC</a> implementation built on http4s would be fantastic, even for the JVM. Christopher Davenport has published a <ahref="https://github.com/ChristopherDavenport/grpc-playground">proof-of-concept</a>.</li>
230
-
</ul>
231
-
<ul>
232
-
<li><ahref="https://github.com/satabin/fs2-data/">fs2-data</a> has pure Scala support for a plethora of data formats. The <ahref="https://github.com/http4s/http4s-fs2-data">http4s-fs2-data</a> integration needs your help to get off the ground!</li>
233
-
</ul>
234
-
<ul>
235
-
<li>
236
-
<p>Lack of cross-platform cryptography is one of the remaining sore points in cross-building. I started the <ahref="https://github.com/typelevel/bobcats">bobcats</a> project to fill the gap but I am afraid it needs love from a more dedicated maintainer.</p>
221
+
<ul>
222
+
<li>Go <ahref="https://github.com/typelevel/feral">feral</a> and implement a pure Scala <ahref="https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html">custom AWS Lambda runtime</a> that cross-builds for Native.</li>
223
+
<li>A pure Scala <ahref="https://grpc.io/">gRPC</a> implementation built on http4s would be fantastic, even for the JVM. Christopher Davenport has published a <ahref="https://github.com/ChristopherDavenport/grpc-playground">proof-of-concept</a>.</li>
224
+
<li><ahref="https://github.com/satabin/fs2-data/">fs2-data</a> has pure Scala support for a plethora of data formats. The <ahref="https://github.com/http4s/http4s-fs2-data">http4s-fs2-data</a> integration needs your help to get off the ground!</li>
225
+
<li>Lack of cross-platform cryptography is one of the remaining sore points in cross-building. I started the <ahref="https://github.com/typelevel/bobcats">bobcats</a> project to fill the gap but I am afraid it needs love from a more dedicated maintainer.</li>
226
+
</ul>
237
227
</li>
238
228
<li>
239
229
<p>Integrations with native libraries:</p>
240
-
</li>
241
-
</ul>
242
-
<ul>
243
-
<li>I kick-started <ahref="https://github.com/http4s/http4s-curl/">http4s-curl</a> and would love to see someone take the reigns!</li>
244
-
</ul>
245
-
<ul>
246
-
<li>An <ahref="https://unit.nginx.org/">NGINX Unit</a> server backend for http4s promises exceptional performance. <ahref="https://github.com/lolgab/snunit">snunit</a> pioneered this approach.</li>
247
-
</ul>
248
-
<ul>
249
-
<li>Using <ahref="https://github.com/cloudflare/quiche">quiche</a> for HTTP/3 looks yummy!</li>
250
-
</ul>
251
-
<ul>
252
-
<li>
253
-
<p>An idiomatic wrapper for <ahref="https://www.sqlite.org/index.html">SQLite</a>. See also <ahref="https://github.com/davenverse/sqlite-sjs/pull/1">davenverse/sqlite-sjs#1</a> which proposes cross-platform API backed by Doobie on the JVM.</p>
230
+
<ul>
231
+
<li>I kick-started <ahref="https://github.com/http4s/http4s-curl/">http4s-curl</a> and would love to see someone take the reigns!</li>
232
+
<li>An <ahref="https://unit.nginx.org/">NGINX Unit</a> server backend for http4s promises exceptional performance. <ahref="https://github.com/lolgab/snunit">snunit</a> pioneered this approach.</li>
233
+
<li>Using <ahref="https://github.com/cloudflare/quiche">quiche</a> for HTTP/3 looks yummy!</li>
234
+
<li>An idiomatic wrapper for <ahref="https://www.sqlite.org/index.html">SQLite</a>. See also <ahref="https://github.com/davenverse/sqlite-sjs/pull/1">davenverse/sqlite-sjs#1</a> which proposes cross-platform API backed by Doobie on the JVM.</li>
235
+
</ul>
254
236
</li>
255
237
<li>
256
238
<p>Developing I/O-integrated runtimes:</p>
257
-
</li>
258
-
</ul>
259
-
<ul>
260
-
<li><ahref="https://github.com/armanbilge/epollcat">epollcat</a> supports Linux and macOS and has plenty of opportunity for optimization and development.</li>
261
-
</ul>
262
-
<ul>
263
-
<li>A <ahref="https://github.com/libuv/libuv/">libuv</a>-based runtime would have solid cross-OS support, including Windows. Prior art in <ahref="https://github.com/scala-native/scala-native-loop/">scala-native-loop</a>.</li>
264
-
</ul>
265
-
<ul>
266
-
<li>
267
-
<p>Personally I am excited to work on an <ahref="https://en.wikipedia.org/wiki/Io_uring">io_uring</a> runtime.</p>
239
+
<ul>
240
+
<li><ahref="https://github.com/armanbilge/epollcat">epollcat</a> supports Linux and macOS and has plenty of opportunity for optimization and development.</li>
241
+
<li>A <ahref="https://github.com/libuv/libuv/">libuv</a>-based runtime would have solid cross-OS support, including Windows. Prior art in <ahref="https://github.com/scala-native/scala-native-loop/">scala-native-loop</a>.</li>
242
+
<li>Personally I am excited to work on an <ahref="https://en.wikipedia.org/wiki/Io_uring">io_uring</a> runtime.</li>
243
+
</ul>
268
244
</li>
269
245
<li>
270
246
<p>Tooling. Anton Sviridov has spear-headed two major projects in this area:</p>
271
-
</li>
272
-
</ul>
273
-
<ul>
274
-
<li><ahref="https://github.com/indoorvivants/sbt-vcpkg/">sbt-vcpkg</a> is working hard to solve the native dependency problem.</li>
275
-
</ul>
276
-
<ul>
277
-
<li><ahref="https://github.com/indoorvivants/sn-bindgen">sn-bindgen</a> generates Scala Native bindings to native libraries directly from <code>*.h</code> header files. I found it immensely useful while working on http4s-curl, epollcat, and the s2n-tls integration in FS2.</li>
278
-
</ul>
279
-
<ul>
280
-
<li>
281
-
<p>Also: we are <em>badly</em> in need of a pure Scala port of the <ahref="https://github.com/openjdk/jmh">Java Microbenchmark Harness</a>. Not the whole thing obviously, but just enough to run the existing Cats Effect benchmarks for example.</p>
247
+
<ul>
248
+
<li><ahref="https://github.com/indoorvivants/sbt-vcpkg/">sbt-vcpkg</a> is working hard to solve the native dependency problem.</li>
249
+
<li><ahref="https://github.com/indoorvivants/sn-bindgen">sn-bindgen</a> generates Scala Native bindings to native libraries directly from <code>*.h</code> header files. I found it immensely useful while working on http4s-curl, epollcat, and the s2n-tls integration in FS2.</li>
250
+
<li>Also: we are <em>badly</em> in need of a pure Scala port of the <ahref="https://github.com/openjdk/jmh">Java Microbenchmark Harness</a>. Not the whole thing obviously, but just enough to run the existing Cats Effect benchmarks for example.</li>
0 commit comments