• # Julia

    Posté par (site web personnel, Mastodon) . En réponse au journal Le taptempo du web. Évalué à 2.

    #!/usr/local/bin/julia
    using HTTP
    using HTTP.Messages
    using Random
    using Logging
    using Sockets
    LogLevel(Logging.Warn)
    if length(ARGS)<2
     println("Missing arguments : Usage 'random_url_server.jl port nbImages'")
     exit();
    end
    port=parse(Int64,ARGS[1])
    nbImg=parse(Int64,ARGS[2])+1
    HTTP.listen(Sockets.localhost,port) do http::HTTP.Stream
     if uri(http.message)=="/"
     HTTP.setstatus(http, 307) # Temporary Redirect
     HTTP.setheader(http, "Location" => string("https://avatar.spacefox.fr/Renard-",rand(1:nbImg),".png"))
     HTTP.startwrite(http)
     end
    end

    C'est un langage réputé performant. Par contre il se "compile" au premier appel alors j'ai fais un premier appel avant le test.

    ab -n 100000 -c 10 http://localhost:3000/
    This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    Benchmarking localhost (be patient)
    Completed 10000 requests
    Completed 20000 requests
    Completed 30000 requests
    Completed 40000 requests
    Completed 50000 requests
    Completed 60000 requests
    Completed 70000 requests
    Completed 80000 requests
    Completed 90000 requests
    Completed 100000 requests
    Finished 100000 requests
    Server Software: 
    Server Hostname: localhost
    Server Port: 3000
    Document Path: /
    Document Length: 0 bytes
    Concurrency Level: 10
    Time taken for tests: 16.392 seconds
    Complete requests: 100000
    Failed requests: 0
    Non-2xx responses: 100000
    Total transferred: 8657325 bytes
    HTML transferred: 0 bytes
    Requests per second: 6100.53 [#/sec] (mean)
    Time per request: 1.639 [ms] (mean)
    Time per request: 0.164 [ms] (mean, across all concurrent requests)
    Transfer rate: 515.76 [Kbytes/sec] received
    Connection Times (ms)
     min mean[+/-sd] median max
    Connect: 0 0 0.1 0 4
    Processing: 0 2 1.1 1 76
    Waiting: 0 1 1.1 1 76
    Total: 1 2 1.1 1 76
    Percentage of the requests served within a certain time (ms)
     50% 1
     66% 2
     75% 2
     80% 2
     90% 2
     95% 2
     98% 3
     99% 4
     100% 76 (longest request)
    

    Sous licence Creative common. Lisez, copiez, modifiez faites en ce que vous voulez.