# Is Julia the right tool for the job?

**URL:** <https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100>\
**Category:** New to Julia\
**Created:** [January 25, 2019, 5:15pm UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100 "2019-01-25T17:15:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkbrito](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@mkbrito](https://discourse.julialang.org/u/mkbrito)\
**Post date:** [January 25, 2019, 5:15pm UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100/1 "2019-01-25T17:15:48Z")

</div>

Hi everyone.

So I have to create something that runs/calls ffmpeg/libav and takes screenshots of a video in specific timestamps.  
I may want to spawn multiple “screenshot operations” in parallel.

I thought about using Julia because:

- Bindings for libav ([https://github.com/kmsquire/VideoIO.jl](https://github.com/kmsquire/VideoIO.jl))
- Decent dependency management (or better than C)
- Parallelism (yay)
- Compiled + LLVM

Question marks for me:

- GC pauses
- Working with Julia in a containerized environment (Docker)

I could spawn a child process for this in Python or Node.js, but I want to have full control of what’s happening with the video processing. (or maybe theres a way to do that with a child process but I dont know how)

Either way, apart from this being a Julia-related forum, is Julia the right, or rather, even a good tool for this job?  
Let me know your opinions 🙂

Thanks!

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [January 25, 2019, 7:39pm UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100/2 "2019-01-25T19:39:46Z")

</div>

> - GC pauses

I’d check how much garbage is created in VideoIO.jl, if the amount isn’t large, you should be able to run in nearly constant time with very few world stops.

> - Working with Julia in a containerized environment (Docker)

Julia is much more self-contained compared to Python, so you usually don’t need Docker (that hard). However, if Docker is already in your tech stack, there should be no issues with running Julia inside a container.

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 25, 2019, 10:17pm UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100/3 "2019-01-25T22:17:42Z")

</div>

> [@mkbrito](#):
>
> GC pauses

This is how long a GC sweep takes when there is nothing to do:

```julia
julia> using BenchmarkTools

julia> @btime GC.gc()
  46.886 ms (0 allocations: 0 bytes)

```

It is entirely possible (and in my opinion easier than in any other garbage collected language I know of) to write code that doesn’t allocate dynamically (so that you can turn off the GC), but it still takes some effort.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 25, 2019, 10:26pm UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100/4 "2019-01-25T22:26:06Z")

</div>

> [@tkoolen](#):
>
> This is how long a GC sweep takes when there is nothing to do:

No it isn’t. Try `GC.gc(false)`

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 25, 2019, 10:28pm UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100/5 "2019-01-25T22:28:51Z")

</div>

Interesting. Is a full GC sweep never run automatically?

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [January 25, 2019, 10:32pm UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100/6 "2019-01-25T22:32:10Z")

</div>

> [@mkbrito](#):
>
> Working with Julia in a containerized environment (Docker)

Doing this is completely trivial, it should be no harder than it is with any other language (and maybe easier). There is one important caveat though: because as of now Julia still needs to re-compile everything every time the `julia` process itself restarts, if you are expecting to use docker containers that are repeatedly starting fresh, the startup time will be rather poor. You can mitigate this somewhat by doing `using Packages` (where `Packages` are the packages you expect to use in whatever you want to run) in your `Dockerfile`, but it doesn’t solve the problem. You could experiment with using [PackageCompiler](https://github.com/JuliaLang/PackageCompiler.jl) but in my experience it takes some effort to get this working.

If on the other hand you intend on keeping your docker container up all the time, or you don’t really care about start-up time anyway, you have nothing to worry about.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 25, 2019, 10:34pm UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100/7 "2019-01-25T22:34:57Z")

</div>

No but that’s not something it’ll do “when there’s nothing to do”. I.e. a lightly allocating program without a lot of persisting allocation should be able to run without hitting a full sweep.

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 26, 2019, 6:24am UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100/8 "2019-01-26T06:24:25Z")

</div>

Thanks very much for providing first-hand knowledge of garbage collector internals. While it would be good to have tight guaranteed bounds on GC time for e.g. serious robot control purposes in the presence of dynamic memory allocation, this is already much better than what I thought was the state of affairs.

---

<div class="post-metadata">

**Author:** ![mkbrito](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@mkbrito](https://discourse.julialang.org/u/mkbrito)\
**Post date:** [January 26, 2019, 1:39pm UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100/9 "2019-01-26T13:39:31Z")

</div>

Thanks for the answer!  
I see you also work on the Kafka related libs for Julia.  
Thanks so much for the work, I will be needing to use them as well (RDKafka) 😃

---

<div class="post-metadata">

**Author:** ![mkbrito](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@mkbrito](https://discourse.julialang.org/u/mkbrito)\
**Post date:** [January 26, 2019, 1:39pm UTC](https://discourse.julialang.org/t/is-julia-the-right-tool-for-the-job/20100/10 "2019-01-26T13:39:34Z")

</div>

Thanks for your answer!  
Yes, I will spawn a new container for every request I get for a new series of screenshots. This way I can scale it horizontally, since I am using Kafka to process such requests.
