Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent pauses in connection #1008

Closed
chris-b1 opened this issue Feb 5, 2023 · 1 comment
Closed

Intermittent pauses in connection #1008

chris-b1 opened this issue Feb 5, 2023 · 1 comment

Comments

@chris-b1
Copy link
Contributor

chris-b1 commented Feb 5, 2023

  • Julia 1.8
  • HTTP.jl 1.7.4

Set-up here, copied out julia code below
https://gist.github.com/chris-b1/87cdf64b3147587695ffe44439fa3ff1

I'm getting fairly frequent 300ms+ pauses on requests, setting up the connection
image
image

In a real, heavier application these pauses are occurring more frequently. Tested on both Windows and WSL

using HTTP, JSON3, Sockets, Tables

const router = HTTP.Router()

function middleware(handler)
	return function(req::HTTP.Request)
		ret = handler(req)
		if ret isa HTTP.Response
			return ret
		end
		return HTTP.Response(200, JSON3.write(ret))
	end
end

function index(req::HTTP.Request)
	home = read("index.html")
	return HTTP.Response(200, home)
end
HTTP.register!(router, "GET", "/", index)

const data = Tables.rowtable((; a=rand(100), b=rand(100), c=rand(100)))

function api(req::HTTP.Request)
	return data
end
HTTP.register!(router, "GET", "/api/test", api)

HTTP.serve(router |> middleware, Sockets.localhost, 8033)
@chris-b1
Copy link
Contributor Author

Not able to reproduce this reliably on a different windows machine - might have just been constrained memory on the other box making more GC pauses? Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant