# Peformance Benckmark of HTTP.jl

**URL:** <https://discourse.julialang.org/t/peformance-benckmark-of-http-jl/55642>\
**Category:** Performance\
**Tags:** package, http\
**Created:** [February 19, 2021, 6:46pm UTC](https://discourse.julialang.org/t/peformance-benckmark-of-http-jl/55642 "2021-02-19T18:46:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DataPsycho](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datapsycho/32/16891_2.png) [@DataPsycho](https://discourse.julialang.org/u/DataPsycho)\
**Post date:** [February 19, 2021, 6:46pm UTC](https://discourse.julialang.org/t/peformance-benckmark-of-http-jl/55642/1 "2021-02-19T18:46:43Z")

</div>

Hi,  
Does any one one have a proper performance bench mark of HTTP.jl . I have build same service in 3 different framework GinTonic-GO, HTTP.jl - Julia, Flask-Restful - Python. I though I will get a lot better performance on Go than Julia or Python. But it seems like Flask-Gunicorn based api still wins the race. May be the app is to simple to compare the performance. I have deployed them on google cloud Run and created a client in GO to send concurrent Post request and log the request time for each request.

![benchmark](https://global.discourse-cdn.com/julialang/original/3X/a/c/ac3069ce627cc063ac00bb4c80072a0302f5d13b.png)

But also time to time I got some server log in the google cloud log but did not know what is the reason for julia and if it is some sort of error.

 ![Screenshot 2021-02-19 at 19.37.31](https://global.discourse-cdn.com/julialang/original/3X/3/c/3c692af1cb4c1ab49c264146f02de0f23c52b896.png)

When running with 2 processor and spanning a separate task thread the julia app was crashing for more that 1000 call. [This repository](https://gitlab.com/juliavrese/benchmark-http.jl) has all the apps. The analysis and data are in that [repository](https://gitlab.com/juliavrese/benchmark-http.jl/benchmarks). Though I have removed the actual server end points just trying to avoid any random request.

---

<div class="post-metadata">

**Author:** ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Post date:** [February 19, 2021, 7:13pm UTC](https://discourse.julialang.org/t/peformance-benckmark-of-http-jl/55642/2 "2021-02-19T19:13:21Z")

</div>

I would try something like this:

```julia
function request_handler(req)
    ch = Channel{Response}(1; spawn=true) do
        obj = HTTP.handle(ROUTER, req)
        return HTTP.Response(200, JSON3.write(obj))
    end
    return take!(ch)
end

```

Granted that not going to keep a thread free like your Worker.jl appears to be trying to do. You might try looking at:

> **[GitHub - tro3/ThreadPools.jl: Improved thread management for background and...](https://github.com/tro3/ThreadPools.jl)**
>
> Improved thread management for background and nonuniform tasks in Julia. Docs at https://tro3.github.io/ThreadPools.jl - GitHub - tro3/ThreadPools.jl: Improved thread management for background and...

To schedule tasks off the primary thread.

You might also want to use the HTTP.Stream interface of HTTP.jl so you can write the responses inside the spawned task. I believe HTTP.jl hasn’t been updated to run on multiple threads so all the responses are written by the primary thread.
