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

gitea 1.12.1 arm-6 generates huge load on synology DS216j #12016

Closed
2 of 7 tasks
ledofnrn opened this issue Jun 22, 2020 · 18 comments
Closed
2 of 7 tasks

gitea 1.12.1 arm-6 generates huge load on synology DS216j #12016

ledofnrn opened this issue Jun 22, 2020 · 18 comments
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail performance/speed performance issues with slow downs

Comments

@ledofnrn
Copy link

Description

On Synology DS216j (2 core armada cpu, 512MB ram) all versions of gitea up to 1.11.8 have been working very well. After upgrading to 1.12.0 (the same with 1.12.1) the load increases hugly:
image
which causes gitea web page to start enormously slowly:
image

Downgrading to 1.11.8 or earlier decreases the load to reasonable level:
image
And the webpage opens promptly again:
image
...

In each case the gitea arm-6 build downloaded from the gitea download site was used.

Please let me know if you need any logs or setup/config details.

Screenshots

@lafriks
Copy link
Member

lafriks commented Jun 22, 2020

If you have many repositories it will get back to normal load when all language statistics have been calculated

@lunny lunny added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Jun 23, 2020
@lunny
Copy link
Member

lunny commented Jun 23, 2020

We should add this to the blog so that users know what will happen when they upgrade to v1.12.

@m3nu
Copy link

m3nu commented Jun 24, 2020

Same experience here. I've been running it on a 512MB VPS and 1.12 fails due to RAM error. 1.11.8 works fine.

@neiaberau
Copy link

neiaberau commented Jul 3, 2020

I do not know if this is relevant or not, and certainly at a much lower scale I would no expect to see any
relevant cpu or memory usage reported, but in this very simple scenario 1.12 uses more RAM/CPU than 1.11

I spun up 2 docker containers, without even having setup and configured gitea at all i.e. without any repositories, this is what I got after letting in run for a while:

docker ps
NAMES IMAGE STATUS
gitea_11 gitea/gitea:1.11 Up 11 minutes
gitea gitea/gitea:1 Up 11 minutes

htop -p 20777,21186

PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
21186 1900 20 0 232M 133M 46020 S 0.0 0.8 0:01.33 /app/gitea/gitea web <= gitea: 1.11
20777 1900 20 0 904M 187M 64056 S 0.7 1.2 0:04.13 /app/gitea/gitea web <= gitea:1 (at the time match 1.12...

is this to be expected?

comment added:
sorry, this is not arm cpu, so it does not match this topic in this respect, but it might be the same cause

@ledofnrn
Copy link
Author

ledofnrn commented Jul 3, 2020

After following lafrikses advice everything came back to normal. I'm running 1.12.1 since then with no other issues. BTW, thanks to all for the prompt replies.

@neiaberau
Copy link

letting it run 1.5 days longer, still not a big issue, but 1.12 is still using 9*more cpu than 1.11, and I wonder why, as this is till a installation without any repository

htop
21186 1900 20 0 232M 133M 46020 S 0.0 0.8 1:30.18 /app/gitea/gitea web
20777 1900 20 0 904M 188M 64312 S 0.7 1.2 13:05.06 /app/gitea/gitea web

@anthonyvdotbe
Copy link
Contributor

Same issue here, running on a Raspberry Pi 3 with 1GB RAM.

@lafriks

  • is it possible to disable this calculation, so I can verify that this is indeed the problem?
  • is there a way to see the progress of the calculation, so I can verify that it's actually making progress?

Thanks!

@zeripath
Copy link
Contributor

zeripath commented Jul 5, 2020

From the comments it's very difficult to determine if these complaints are regarding base load for a brand new instance or are regarding load just following migration.

There are a number of heavy working migrations between 1.11 and 1.12 and therefore it is not surprising that load would increase considerably during the migration. It would be helpful to disentangle these issues from the base load.

If there are complaints about load during migration and immediately following migration - I'm afraid there's not much we can do. This is work that has to happen - but will only happen once.

If there are complaints about base load - well then we need more information. Just giving us the information from htop or top isn't very useful - in the administration pages there is a process page that will give you an idea of how many workers have been created, and what processes are currently being run. There is also information about current load on the dashboard.

The provided logging gists are also unfortunately unhelpful. Although the default logging sets [database] LOG_SQL=true this is often not too helpful for us unless there is a particular database issue and the noise it creates hides lots of important information. It would be helpful to consider giving us some logs with a different configuration:

[database]
...
LOG_SQL=false
...

[log]
MODE=console
LEVEL=debug
REDIRECT_MACARON_LOG=true
MACARON=console
ROUTER=console

or send these logs to files and provide them.


If there is genuinely increased base load it may be helpful to tune the default queue configurations - as it's possible that too many things are being attempted at once.

Consider reducing the MAX_WORKERS for all queues to 1?

[queue]
...
MAX_WORKERS=1

Consider switching the default queue type to a level queue?

[queue]
TYPE=level

There is also the issue that Go 1.14 has caused increased issues with ASYNC_PREEMPT which we have had to turn off. This could be causing issues with increased load? Compiling with Go 1.13 might help?

@lunny
Copy link
Member

lunny commented Jul 7, 2020

@neiaberau have you restarted two gitea instances after the migrations finished?

@anthonyvdotbe
Copy link
Contributor

In my case, it's about base load since upgrading to 1.12.0 (I'm currently running 1.12.2).

This also occurs with MAX_WORKERS set to 1:

[queue]
MAX_WORKERS = 1

I haven't changed the default queue type. Unless the default type has changed in 1.12.0, I don't see how that could suddenly start causing issues?

I've changed the log configuration as advised. The only thing of note is that gitea.log contains hundreds of occurrences of this stack trace:

2020/07/25 09:47:39 routers/repo/http.go:614:getInfoRefs() [E] fork/exec /usr/bin/git: cannot allocate memory - 
	/go/src/code.gitea.io/gitea/routers/repo/http.go:614 (0x12fe2c8)
	/go/src/code.gitea.io/gitea/routers/repo/http.go:371 (0x12f99b3)
	/usr/local/go/src/reflect/value.go:460 (0xa3333)
	/usr/local/go/src/reflect/value.go:321 (0xa2b13)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:177 (0x72df23)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:137 (0x72da0f)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0xca754f)
	/go/src/code.gitea.io/gitea/modules/context/panic.go:39 (0xca7538)
	/usr/local/go/src/reflect/value.go:460 (0xa3333)
	/usr/local/go/src/reflect/value.go:321 (0xa2b13)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:177 (0x72df23)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:137 (0x72da0f)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0xc68c3b)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/session/session.go:192 (0xc68c20)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:79 (0x7446c7)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:157 (0x72dcbf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:135 (0x72dabf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0x752d1b)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/recovery.go:161 (0x752d04)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/logger.go:40 (0x7479f3)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:157 (0x72dcbf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:135 (0x72dabf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0x1451653)
	/go/src/code.gitea.io/gitea/routers/routes/routes.go:103 (0x1451638)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:79 (0x7446c7)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:157 (0x72dcbf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:135 (0x72dabf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/router.go:187 (0x753d07)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/router.go:303 (0x74e72f)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/macaron.go:218 (0x748bb3)
	/go/src/code.gitea.io/gitea/vendor/github.com/gorilla/context/context.go:141 (0x988f6b)
	/usr/local/go/src/net/http/server.go:2012 (0x2f3953)
	/usr/local/go/src/net/http/server.go:2807 (0x2f6297)
	/usr/local/go/src/net/http/server.go:1895 (0x2f285f)
	/usr/local/go/src/runtime/asm_arm.s:857 (0x7895b)

and there are also 3 occurrences of this stack trace:

2020/07/25 14:52:21 ...ules/context/repo.go:792:func1() [E] GetCommitsCount: fork/exec /usr/bin/git: cannot allocate memory
	/go/src/code.gitea.io/gitea/modules/context/repo.go:792 (0xcaab90)
	/usr/local/go/src/reflect/value.go:460 (0xa3333)
	/usr/local/go/src/reflect/value.go:321 (0xa2b13)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:177 (0x72df23)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:137 (0x72da0f)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0xca96fb)
	/go/src/code.gitea.io/gitea/modules/context/repo.go:579 (0xca96e0)
	/usr/local/go/src/reflect/value.go:460 (0xa3333)
	/usr/local/go/src/reflect/value.go:321 (0xa2b13)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:177 (0x72df23)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:137 (0x72da0f)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0xca754f)
	/go/src/code.gitea.io/gitea/modules/context/panic.go:39 (0xca7538)
	/usr/local/go/src/reflect/value.go:460 (0xa3333)
	/usr/local/go/src/reflect/value.go:321 (0xa2b13)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:177 (0x72df23)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:137 (0x72da0f)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0xc68c3b)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/session/session.go:192 (0xc68c20)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:79 (0x7446c7)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:157 (0x72dcbf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:135 (0x72dabf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0x752d1b)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/recovery.go:161 (0x752d04)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/logger.go:40 (0x7479f3)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:157 (0x72dcbf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:135 (0x72dabf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0x1451653)
	/go/src/code.gitea.io/gitea/routers/routes/routes.go:103 (0x1451638)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:79 (0x7446c7)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:157 (0x72dcbf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:135 (0x72dabf)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x744803)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/router.go:187 (0x753d07)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/router.go:303 (0x74e72f)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/macaron.go:218 (0x748bb3)
	/go/src/code.gitea.io/gitea/vendor/github.com/gorilla/context/context.go:141 (0x988f6b)
	/usr/local/go/src/net/http/server.go:2012 (0x2f3953)
	/usr/local/go/src/net/http/server.go:2807 (0x2f6297)
	/usr/local/go/src/net/http/server.go:1895 (0x2f285f)
	/usr/local/go/src/runtime/asm_arm.s:857 (0x7895b)

Are there any binaries available of Gitea 1.12+ that were compiled with Go 1.13?

@neiaberau
Copy link

neiaberau commented Aug 15, 2020

I guess these are all different issues,
in my case, base load, it seems to be related to the new queue handing introduced in 1.12 sometime in January,
with this added (which I guess should not be the final configuration), the load is gone

[queue.issue_indexer]
WORKERS = 0
MAX_WORKERS = 0
TYPE = dummy

[queue]
TYPE = dummy

@zeripath
Copy link
Contributor

zeripath commented Aug 15, 2020

Don't set your workers to 0, nothing will get done. That is an absolutely and utterly terrible idea.


Worse you'll get deadlocks as the queues get full!

@zeripath
Copy link
Contributor

You need to work out if it is a particular queue is causing the problem or if the default queue settings use too many resources.

If I had to bet - I would guess that the repo stats indexer was using too much memory - AFAIU there was an issue which should have been resolved in the latest 1.12 version. You do not say which version you are using.

If - however - it's not a particular queue which is causing this problem then it's worth noting that there are multiple different options for Queues - the default settings are likely not the correct for low powered systems.

For example:

The default queue is the persistable channel queue - that involves a memory channel queue which will get dumped to a file level queue at shutdown. It's possible that you might be better off changing the type to a simple channel queue - with the potential loss of data on shutdown - or to a disk only queue or redis queue.

It might be that the underlying length of the memory components for queues is too big and you need to set them smaller.

[repository]
...
; Mirror sync queue length, increase if mirror syncing starts hanging
MIRROR_QUEUE_LENGTH = 1000 
; Patch test queue length, increase if pull request patch testing starts hanging
PULL_REQUEST_QUEUE_LENGTH = 1000

...

[webhook]
; Hook task queue length, increase if webhook shooting starts hanging
QUEUE_LENGTH = 1000

...

[task]
; Task queue length, available only when `QUEUE_TYPE` is `channel`.
QUEUE_LENGTH = 1000 
...

[queue]
; Default queue length before a channel queue will block
LENGTH = 20

...

Reducing the length for most of these things would help reduce the amount of memory used. Switching to a disk queue, or redis queue might help too.

@neiaberau
Copy link

as I wrote above

I guess should not be the final configuration

setting it workers to 1 seams still ok, as long as I as keep the type=dummy
will to some tests with above settings

@zeripath
Copy link
Contributor

zeripath commented Oct 7, 2020

Using dummy as the queue type means that there are no workers as no work gets done.

You cannot have dummy as your queue type.

Have things improved with 1.12.5?

My suspicion is that the problem is that the repo stats indexer is to blame for the increased load. Does reducing the length of its queue help?

@m3nu
Copy link

m3nu commented Feb 9, 2021

Have things improved with 1.12.5?

I just tried again with the latest 1.13.2 after using 1.11.8 for longer than I had wanted. It looks like @zeripath is correct and the high load on startup is caused my migration tasks. I have 512 MB RAM and a large SWAP file. So when I first started 1.13.2 wait-io was very high and it used 500 MB+ in RAM. After about 30 min it stabilized and the next startups were all fast and it only uses about 200 MB RAM now.

I also adjusted the number of workers, as suggested above, but can't say if it made a big difference:

[queue]
MAX_WORKERS = 1
TYPE=level

@lunny
Copy link
Member

lunny commented Feb 9, 2021

And you could change the default PASSWORD_HASH_ALGO to not use argon2 if you have less memory.

@noerw noerw added the performance/speed performance issues with slow downs label Mar 24, 2021
@zeripath
Copy link
Contributor

I believe that these issues should have been solved with the changes to the default queue settings in #15964, #15724, #15696, #15725, & #15963.

@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail performance/speed performance issues with slow downs
Projects
None yet
Development

No branches or pull requests

8 participants