Skip to content
ContanoDev edited this page Jul 14, 2024 · 4 revisions

Why not use net/http instead of fasthttp?

Well, first I've tried it in gin and it got a really bad performance.

Fasthttp has very high performance, of course, it does this by trading memory for CPU, but net/http doesn't seem to help at all, and is actually worse.

After I replaced fasthttp with gin, turned off active GC, and then uploaded to vine-server, the memory usage of gin was twice that of fasthttp (when active GC was also turned off for fasthttp). Oh no....

Since I didn't have git setup, I wasted an hour of my life testing it and then slowly rolling it back. So now Mars is still based on fasthttp.

Can I use TLS on Mars?

It is not recommended to do this. Although I added TLS support in 1.3.0, it is still experimental. You should close the public access of the Mars port in the firewall, and then use software such as caddy, nginx to proxy its traffic.

How much memory should Mars occupy?

I will upload two jars, bundler and paperclip, at the same time. They occupy 143M on the hard disk. After passing Mars, Mars occupies 123M of memory. If active_gc is enabled, the memory is recycled to 57M after the upload is completed. If all_recycled is enabled, it is 7M.

Is there any difference between v1-v4?

In the AMD64 architecture in Golang, there are four architectural levels.Each level differs in the set of x86 instructions that the compiler can include in the generated binaries:

  • v1 (default): The baseline. Exclusively generates instructions that all 64-bit x86 processors can execute.
  • v2: all v1 instructions, plus CMPXCHG16B, LAHF, SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3.
  • v3: all v2 instructions, plus AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, OSXSAVE.
  • v4: all v3 instructions, plus AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL.

It is recommended to run Mars on a processor that supports v3-v4, which can bring higher performance improvements. The arm64 architecture processor only includes sha256 calculation acceleration.