abmclin
2018-2-13 13:36:04

That’s pretty neat, I started to fiddle around with using replace-evt and handle-evt to see if I could figure out a threadless version but wasn’t able to make it work. I see I was missing choice-evt. This is quite fun exercise.


dedbox
2018-2-13 16:23:24

@abmclin I love events — faster than threads for IO-bound concurrency. There’s a thread-friendly “cooperative” multitasking DSL or two in them somewhere, I’m sure.


dedbox
2018-2-13 16:27:39

With a more convenient arrangement, they’re easier to work with. I’ve started collecting event-based primitives in another project, documented here (http://docs.racket-lang.org/neuron/Control_Your_Resources.html#%28def._%28%28lib._neuron%2Fconcurrency..rkt%29._evt-set%29%29)


dedbox
2018-2-13 16:30:38

The reset of the procedures in that section are implemented as events, threads, or both.


dedbox
2018-2-13 16:36:30

Neuron is (at the moment) a dataflow networking library, where thread-like “processes” can exchange messages through synchronous channels.


githree
2018-2-13 16:37:30

@dedbox what is the end goal of the Neuron?


dedbox
2018-2-13 16:38:39

@githree roughly, to turn the Internet into a giant artificial brain.


dedbox
2018-2-13 16:40:57

Right now, it’s just a dataflow networking library on top of a custom concurrency model


dedbox
2018-2-13 16:42:07

I have apps working as PoCs driving a multiplayer game server back end and small-scale web app stuff.


githree
2018-2-13 16:42:35

@dedbox interesting what problem does Neuron address?


dedbox
2018-2-13 16:42:47

That’s a great question


dedbox
2018-2-13 16:44:21

I think the Web has become too dependent on massive centralized services and want to level the playing field, so to speak, without having to fight big companies head on


dedbox
2018-2-13 16:45:29

I think society has problems related to these circumstances and want to provide healthier alternatives to toxic echo chambers and stuff like that


githree
2018-2-13 16:45:53

I like it even more now :wink:


githree
2018-2-13 16:46:13

Can you give an ultimate use case for Neuron


dedbox
2018-2-13 16:48:06

That’s a tough one


dedbox
2018-2-13 16:48:53

It’s a toolkit for growing software ecosystems, like Racket and its package manager and all the communications tools we use to coordinate and share.


githree
2018-2-13 16:48:54

sorry :wink:


dedbox
2018-2-13 16:49:31

It’s all about building communities online by leveraging real world relationships


dedbox
2018-2-13 16:49:41

Right now, it’s just concurrency and some distributed computing


dedbox
2018-2-13 16:50:00

The next big step is to add capability-based security


githree
2018-2-13 16:50:40

thanks for your time - I’ve found neuron on the pkgs website but wasn’t sure what exactly is the purpose of it - it is much clearer now


dedbox
2018-2-13 16:50:57

Cool, thanks for asking. It’s good practice :smiley:


githree
2018-2-13 16:52:39

love the idea, will keep an eye on the project!


abmclin
2018-2-13 17:36:25

@dedbox thanks for the reference to Neuron, it looks interesting. I’m encouraged to study concurrency more extensively. I don’t have a good grasp of the implications of “faster than threads for IO-bound concurrency.” To me concurrency has always had that notorious reputation of being difficult to reason about so it’ll be a good exercise for me to use Racket’s events to solve classical concurrency problems.


abmclin
2018-2-13 17:40:38

looks like Neuron’s been inspired by the pi-calculus, is that a fair assessment?


dedbox
2018-2-13 18:02:53

@abmclin yes, pi calculus also uses synchronous channels


dedbox
2018-2-13 18:03:40

and the dual give/take emit/recv are modeled on pi calculus channel operations


dedbox
2018-2-13 18:11:50

You know, in Neuron’s control flow code, there’s no obvious correlation between events and IO performance. For example, a bridge, which forwards values between two processes, isfaster as a composite event than a collection of threads. A proxy, which does roughly the same thing for a single process, is faster as threads.


abmclin
2018-2-13 18:14:06

my question is how is bridge faster than using a collection of threads? Is it due to overhead of threads or because using events basically is as fast as copy between two memory locations?


dedbox
2018-2-13 18:14:37

I wish I knew how to answer questions like that easily


abmclin
2018-2-13 18:14:41

I had been under the impression that threads are very cheap in Racket


dedbox
2018-2-13 18:15:06

Yeah, and processes are thread + kitchen sink, but sometimes using processes is faster than using threads.


abmclin
2018-2-13 18:15:37

interesting, I find that surprising, though I don’t really have a good intuition yet when Racket threads and concurrency are involved


dedbox
2018-2-13 18:16:15

My totally un-educated guess is some sort of compile-time optimizations


abmclin
2018-2-13 18:16:32

ok


abmclin
2018-2-13 18:17:19

were you using timing measurements to compare the performance of say bridge versus threads


abmclin
2018-2-13 18:17:32

am just curious about how one would go around measuring this kind of stuff


dedbox
2018-2-13 18:18:32

I’d implement using threads first, then raco setup -D neuron && (time raco test control.rkt <three times>) and eyeball the average


dedbox
2018-2-13 18:18:43

Then, repeat with events only


dedbox
2018-2-13 18:18:51

Sometimes, try a combination.


abmclin
2018-2-13 18:18:58

makes sense, ok cool


dedbox
2018-2-13 18:19:28

Threaded code is much nicer to look at


abmclin
2018-2-13 18:20:50

as opposed to using only or mostly events for concurrency?


dedbox
2018-2-13 18:22:11

Yes, events have more syntactic noise because you’re using a continuation-passing style.


abmclin
2018-2-13 18:22:58

ok understood


abmclin
2018-2-13 18:23:08

is Neuron still experimental or a stable alpha package?


dedbox
2018-2-13 18:23:35

Been struggling with that. I think the package is too big.


dedbox
2018-2-13 18:24:35

Part 1 is stable alpha, Part 2 design is stablizing now.


dedbox
2018-2-13 18:24:55

Parts 3 and 4 are vaporware


abmclin
2018-2-13 18:25:25

I noticed that based on how much documentation had been filled out for each of the parts


dedbox
2018-2-13 18:25:57

What you see so far is about one Masters thesis worth ofwork


abmclin
2018-2-13 18:26:02

while I’ve only given it a cursory glance, the package doesn’t seem that big to me, but I’ll defer to your judgement


abmclin
2018-2-13 18:27:49

seems like a nice piece of work, I won’t try to worry too much about trying to perfect it or you’ll never be able to be at peace :sob:


dedbox
2018-2-13 18:28:01

haha learning that the hard way


abmclin
2018-2-13 18:28:10

might be better to let it gain more real-world experience to help guide future improvements


dedbox
2018-2-13 18:28:35

The project stalled until I watched @notjack start the net2 package.


dedbox
2018-2-13 18:29:07

Any more advice on how to think about sharing this would be a huge help


abmclin
2018-2-13 18:29:40

if you feel all the relevant procedures and operations are there and ready to be used in real-world applications then I’d say the first version is ready


abmclin
2018-2-13 18:30:40

part 3 seems rather important since I can see this being useful for types of applications that need to spawn asynchronous processes such as email notifications, background processing, updates, etc


abmclin
2018-2-13 18:30:59

so would be nice to see how Part 3 could help with those kind of scenarios


dedbox
2018-2-13 18:31:33

Ok, good to know.


abmclin
2018-2-13 18:32:26

I’m also thinking of gitlab which basically is a large distributed system of Ruby processes handling various operations such as building, testing, listening and receiving git client connections, monitoring programs, and admin functionality


abmclin
2018-2-13 18:32:55

most of it is implemented in propriety licensed Ruby libraries so not really available for open-source without paying up


abmclin
2018-2-13 18:33:49

I’m thinking of how the Neuron abstractions could serve similar purposes while I’m studying the package docs


abmclin
2018-2-13 18:36:32

the only reason I’m even thinking about gitlab is because I spent the last month setting up and configuring a local gitlab instance for my use so was poking around the innards


dedbox
2018-2-13 18:37:12

Cool! I’ve never peeked inside Gitlab.


dedbox
2018-2-13 18:37:18

It seemed complicated.


abmclin
2018-2-13 18:37:30

it is! but it does its job very well


dedbox
2018-2-13 18:38:41

Neuron is about ready for custom back-end data pipelines. I’ve used similar designs for artificial intelligence and machine learning applications. That could be a v1.


notjack
2018-2-13 18:39:31

hello, neuron is cool :wave:


abmclin
2018-2-13 18:39:35

why not? Seems you already have use cases to showcase Neuron, why not create small-scale examples of AI and ML apps using Neuron. That would be a good way to eat your own dog food.


dedbox
2018-2-13 18:39:44

@notjack hello!


dedbox
2018-2-13 18:40:37

Then maybe v1 should include HTTP/1.1 endpoints


abmclin
2018-2-13 18:42:17

are you thinking of incorporating Racket’s networking support or something from scratch?


dedbox
2018-2-13 18:43:57

From scratch. I actually had them working on an older prototype.


notjack
2018-2-13 18:44:40

and someday there will be http2 in racket :D


dedbox
2018-2-13 18:45:19

Yes, net2 will be a drop-in performance upgrade.


abmclin
2018-2-13 18:45:52

that’s neat


dedbox
2018-2-13 18:46:21

@abmclin by networking support, you mean the net library?


abmclin
2018-2-13 18:47:17

yes that’s the library I’m thinking of, it has http functions and etc, seems a shame to reinvent the wheel if you could avoid that


dedbox
2018-2-13 18:48:48

It didn’t work out so well with the Neuron paradigm.


notjack
2018-2-13 18:49:08

HTTP has changed drastically in the time since the net implementation was written, so it could use some reinventing


abmclin
2018-2-13 18:49:50

yeah such as http2


notjack
2018-2-13 18:50:13

more than that though, the way http1 is used has changed a lot


notjack
2018-2-13 18:50:45

JSON web APIs (and even XML ones) weren’t nearly so common then


abmclin
2018-2-13 18:50:58

right that is true, the use cases have changed a lot


abmclin
2018-2-13 18:51:27

it’s all about user-side interactivity with JSON/XML snippets being passed back and forth


notjack
2018-2-13 18:51:59

plus the http/1.1 spec has been updated and some behaviors in the net implementation are now highly discouraged


abmclin
2018-2-13 18:52:34

ahh I hadn’t been aware of that, would you mind giving an example or two of the discouraged behaviour?


notjack
2018-2-13 18:52:39

also I really don’t like fiddling with headers as : joined bytestrings directly


abmclin
2018-2-13 18:52:55

yeah I won’t like to do that either


notjack
2018-2-13 18:53:19

This used to be legal:

Foo: value1
value2
value3
Bar: whatever

notjack
2018-2-13 18:53:44

Header lines that don’t contain colons were considered continuations of the previous header line


notjack
2018-2-13 18:54:44

that behavior was deprecated in the updated HTTP/1.1 RFCs (7230 through 7235)


abmclin
2018-2-13 18:54:59

I’m following you so far


abmclin
2018-2-13 18:55:13

I probably should review the RFCs, it’s been a long since I’ve done that


abmclin
2018-2-13 18:55:40

the reason that behavior is now deprecated is because the previously legal format is too error prone?


notjack
2018-2-13 18:55:56

I think so, I’m not positive on the specifics


notjack
2018-2-13 18:56:20

I do know that all headers except Set-Cookie are defined to allow “splicing” values together with commas


abmclin
2018-2-13 18:56:29

ok, I rarely ever need to work with headers directly in my work so I’m not sure either


notjack
2018-2-13 18:56:44

Foo: value1\nFoo:value2 is equivalent to Foo: value1,value2


abmclin
2018-2-13 18:57:01

ahh that does look awkward


abmclin
2018-2-13 18:57:28

I can see how allowing multiple legal variants can lead to ambiguity, especially when different browser implementations are available in the wild


notjack
2018-2-13 18:59:06

there’s also stuff the current racket http implementations encourage around connections that can lead to issues


notjack
2018-2-13 18:59:21

for instance, opening multiple TCP connections to the same origin is very rarely a good idea


notjack
2018-2-13 18:59:31

simultaneously, I mean


abmclin
2018-2-13 19:00:00

yeah that’s definitely a no-no most of the time


abmclin
2018-2-13 19:00:27

I’ll be looking forward to seeing your new net2 library


notjack
2018-2-13 19:01:39

it’s slow going since I won’t have much free time for a while, but I’m looking forward to it too :)


abmclin
2018-2-13 19:03:19

always appreciate your hard work one way or another :slightly_smiling_face:


notjack
2018-2-13 19:04:00

happy to hear it’s been useful :thumbsup:


githree
2018-2-13 21:19:36

@dedbox from the conversation above - are you saying Neuron could already be used for let’s say some ETL process?


dedbox
2018-2-13 21:20:31

If you’re writing your own interop layer, then sure.


dedbox
2018-2-13 21:22:30

Out of the box, Neuron instances can exchange messages over the network using s-exp or JSON.


githree
2018-2-13 21:24:33

cool, looking forward to see some sample application as I feel I may have found a use case to play with it in my project


dedbox
2018-2-13 21:26:36

Cool, thanks! I’ll announce any new developments here.


xizhao
2018-2-13 22:30:35

@xizhao has joined the channel