core-async

2021-06-16T19:05:06.059100Z

If I'm using pipeline-blocking and I don't care about the result of my transformation function, what should I put on the 'to' channel?

alexmiller 2021-06-16T19:12:30.060300Z

why are you using pipeline-blocking?

alexmiller 2021-06-16T19:12:45.060700Z

your pipe is leaking on the floor... :)

2021-06-16T19:12:57.061Z

Maybe I shouldn't be... I have a feeling I'm in over my head

alexmiller 2021-06-16T19:17:06.062300Z

I assume your transformation function is doing some potentially blocking i/o?

2021-06-16T19:20:42.063200Z

Yes it is

alexmiller 2021-06-16T19:21:59.063900Z

do you want it to be parallelized? do you want bounded parallelism? do you want back pressure?

2021-06-16T19:23:15.065100Z

I want it to be parallelized, it doesn't have to be bounded although I assume that's the practical thing to do, and the back pressure question is one that I'm still thinking about

alexmiller 2021-06-16T19:24:02.066400Z

I mean, generally you want bounded (unbounded things only stop working at 2 am when you're on call)

😆 1
2021-06-16T19:24:58.067300Z

I wanted to write a writer library for an existing java service that reads json and then in a very blocking way writes into a Tinkerpop graph database.

alexmiller 2021-06-16T19:25:41.068400Z

pipeline-blocking will always write a result into an output channel (that will accumulate)

2021-06-16T19:26:13.069500Z

The service currently takes ~4 hours to run, so I thought that by parallelizing and batching the writes we could achieve a speed up. But I'm not sure how backpressure works in a scenario like this

alexmiller 2021-06-16T19:26:43.070300Z

if you want parallel, bounded, with backpressure but don't care about the results you could give it channel with a dropping buffer that would just immediately drop the "results" on the floor

2021-06-16T19:26:59.070900Z

that's a solution

2021-06-16T19:27:55.072Z

What's a typical n value to use with pipeline-blocking?

alexmiller 2021-06-16T19:28:30.072600Z

you could also just have a go-loop feeding a queue/channel and N threads reading from the queue and pushing stuff into the db

alexmiller 2021-06-16T19:29:52.073600Z

pipeline-blocking is doing a bunch of work to order the results that you presumably don't care about

2021-06-16T19:30:26.074200Z

Yeah I don't really care about the ordering of the results

2021-06-16T19:31:30.076100Z

I should just write it in java anyways

2021-06-16T19:31:38.076400Z

My team doesn't know clojure

2021-06-16T19:32:33.076700Z

Thanks for your help

dpsutton 2021-06-16T19:36:20.076900Z

how would you do this in java?

2021-06-16T19:46:27.078500Z

I'd have to do a little investigation on the best way to do it. Streams are new to me but I could probably make a streams-oriented solution