The text was updated successfully, but these errors were encountered:. I decided to compare some other servers to see what kind of speeds they get in the same setup. In the Windows VM, I ran nodejs serve on port , and python3 http. Python serves up the file slightly slower than golang, but nodejs is much faster than both. Sorry, something went wrong. I also tried nginx on port 80 , which is the fastest so far but still similar to the 8s nodejs result:. I am not an expert in performance tuning.
The slow down can be anywhere. It might help, or might hurt. See, if you do use syscall. TransmitFile or not. Adjust your code, so you could try both "with syscall. TransmitFile" and "without syscall. TransmitFile" versions. See if that makes any difference.
I don't see how I could reproduce your problem here. And, even if I do, I would need C source of your alternative program to be able to try and reproduce your top performance with Go. I believe io. Copy will use TransmitFile if possible. In order to rule that out, I replaced io. Copy with the following snippet:. This should be trivial to reproduce.
Body , counter ; err! The good news is you can do the same in Go and rather simply too. Mock S3 Uploads in Go Tests — Feb 22, A common scenario a back-end web developer might encounter is writing code which uploads a file to an external storage platform, like S3 or Azure.
There are different ways to achieve this in Go - all valid. Using ioutil makes this easy for us by not having to worry about closing files or using buffers. The main reasons I use wget is that it has a lot of useful features like recursive downloading of a website. So you could simply do:. You can select the number of levels using -l flag. Replace the with any number, or you can use 0 to infinitely loop through and download a whole website. Also, the links on the webpages downloaded still point to the original.
You can just mirror the entire website using -m , and the -r, -k and -l flags will be automated. You can make a. MDN web docs says the following about the header: [ Set "Content-Disposition", cd w. ServeContent w, r, d. Name , d. ModTime , f. Community Bot 1 1 1 silver badge. Nergal Nergal 1 1 gold badge 13 13 silver badges 27 27 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password.
Post as a guest Name. Email Required, but never shown. Go Language. Learn more about Collectives on Stack Overflow. The Overflow Blog. Podcast Who is building clouds for the independent developer? Exploding turkeys and how not to thaw your frozen bird: Top turkey questions
0コメント