You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Activitylog service creates endless load on the backend after uploading #716
For now I've not found an issue somewhere but unfortunately I'm also not able to interprete the log line record.
As mentioned in the matrix chat. I think we should not log stuff like this at the "INFO" level. It should at least be down to "DEBUG" or "TRACE".
Regarding interpretation: The line basically just says that the service auth-service just successfully authenticated a service user (type:USER_TYPE_SERVICE). I guess you're more interested in finding out why that authentication happened and what the service user is actually doing there. For the you'd need to look at the surrounding log lines, maybe searching for lines having the same traceid.
In my case, these logs appeared after I copied some GB of data into my non collaborative PosixFS and started OpenCloud up again. From that point on there is one core constantly on 100% with opencloud. I wasn't able yet to pin down what it exactly does... The logfile is so flooded ;-)
In my case, these logs appeared after I copied some GB of data into my non collaborative PosixFS and started OpenCloud up again. From that point on there is one core constantly on 100% with opencloud. I wasn't able yet to pin down what it exactly does... The logfile is so flooded ;-)
I've copied also a bunch of data on filesystem level. ~ 200 GB. My host system was with 8 cores busy for hours.
Also just waited and after 1-2 days the utilization was back to normal. I'm missing currently an option to see the indexing process of the files.
Created a feature request to see the posix indexing status of opencloud: #718
I've copied also a bunch of data on filesystem level. ~ 200 GB. My host system was with 8 cores busy for hours.
Also just waited and after 1-2 days the utilization was back to normal. I'm missing currently an option to see the indexing process of the files.
I'd suggest to open a separate issue for this. It's unrelated to the auth-service's log entries.
For now I've not found an issue somewhere but unfortunately I'm also not able to interprete the log line record.
As mentioned in the matrix chat. I think we should not log stuff like this at the "INFO" level. It should at least be down to "DEBUG" or "TRACE".
Regarding interpretation: The line basically just says that the service auth-service just successfully authenticated a service user (type:USER_TYPE_SERVICE). I guess you're more interested in finding out why that authentication happened and what the service user is actually doing there. For the you'd need to look at the surrounding log lines, maybe searching for lines having the same traceid.
Thanks for the explanation. As the message was in my log presented in read a thought it could be an issue.
If it is just status message about a regular authentication than I agree that it should be visible on higher logging level
Since this still looks like "something" is stating files, I'll continue to wait - if it is still assimilating the files that I copied into the file system I would expect it looks similar.
I straced the opencloud process with strace -fp <pid> to understand what is causing the load. It seems that it tries to stat files that are not (longer) existing over and over again.
The most files that are not existing on my machine, but tried to be stat'ed have the extension .lock or .blk such as:
There is no hard limit to subject size, but it is recommended to keep the maximum number of tokens in your subjects to a reasonable value. E.g. a maximum of 16 tokens and the subject length to less than 256 characters.
I guess we'd be beyond the recommended 256 characters very quick. AFAICS we're already at 176 key length for a single resource id 😢
This is a pprof flame graph (for a 30sec interval) after copying 50000 1kB files manually into a space. File assimilation was already complete at this point. So you can see that the activitylog service is consuming roughly one half of the CPU time (and about a half of that is spent on JSON marshalling and unmarshalling). The rest of the CPU is spent mainly in the NATS server (not sure what it is doing there but Sprintf shows up there pretty promiently) and in the garbage collector (sigh)
This goes on for hours(!). Though I assume this is again because NATS starts to resend un-acked messages on the activitylog.
But I somehow think there must also be a better way to store the Activities than what we currently do.
Hm, thinking about this further might it be possible to just store a single Event instead of storing it several time (once per parent resource). If we'd just use <spaceid>.<parentresourceid>.<parentresourceid>.<....>.<resourceid> as the key?
To get all activities for a specific level of the filetree would be just a matter of doing a kv.Watch() on the <spaceid>.<parentresourceid>.* subject. Queries like *.<resourceid>.* should also work. 🤔
That sounds attractive but has the problem that you'd have to rewrite lots of keys when a directory gets renamed.
I'm not sure if the added complexity is worth the effort.
So now the activitylog consumes just the tiny bit that is highlighted in that screenshot. And it was able to work of the event queue pretty quickly.
Did you also try to implement the reading part or was it just about benchmarking the writes? Hm, and I wonder how expensive it gets to maintain the limit of activities per resource.
I had two other ideas besides buffering the writes (which already gets rid of most of the load):
Use messagepack arrays instead of json, which is considerably faster when marshalling and unmarshalling and doesn't really have any downside in this context as far as I can tell.
Use some kind of write-ahead log to collect a bunch of events in a smaller array before writing it to the "main" array. We'd lose precision with the event limit however and reading the activities would take two reads instead of one.
Did you also try to implement the reading part or was it just about benchmarking the writes? Hm, and I wonder how expensive it gets to maintain the limit of activities per resource.
This was just the writing part. Reading does require some more work. We would need to add Watch() support to the natkv go-mirco driver. Regarding the limit: The current limit of 6000 events per ResourceID was introduced because the values are too large. The suggested approach wouldn't have that issue. I guess we could just use some time based expiry.
I had two other ideas besides buffering the writes (which already gets rid of most of the load):
1. Use messagepack arrays instead of json, which is considerably faster when marshalling and unmarshalling and doesn't really have any downside in this context as far as I can tell.
2. Use some kind of write-ahead log to collect a bunch of events in a smaller array before writing it to the "main" array. We'd lose precision with the event limit however and reading the activities would take two reads instead of one.
Btw, @butonic also commented, that the current implementation looses events as soon as more than a single activitylog instance in running.
changed the title [-]2 journalctl log entries per second start with [user idp:"none" ...][/-][+]Activitylog service creates endless load on the backend after uploading[/+]on May 12, 2025
I ran a few tests to see how it works with and without activity log and if there are any significant differences.
Result: no performance improvement without the activitylog service, the http_req_duration is a tiny bit shorter, but I would rather put that in the test deviation drawer
Activity
dragotin commentedon Apr 24, 2025
renders the log output more or less useless
rhafer commentedon Apr 24, 2025
As mentioned in the matrix chat. I think we should not log stuff like this at the "INFO" level. It should at least be down to "DEBUG" or "TRACE".
Regarding interpretation: The line basically just says that the service
auth-servicejust successfully authenticated a service user (type:USER_TYPE_SERVICE). I guess you're more interested in finding out why that authentication happened and what the service user is actually doing there. For the you'd need to look at the surrounding log lines, maybe searching for lines having the sametraceid.dragotin commentedon Apr 24, 2025
In my case, these logs appeared after I copied some GB of data into my non collaborative PosixFS and started OpenCloud up again. From that point on there is one core constantly on 100% with opencloud. I wasn't able yet to pin down what it exactly does... The logfile is so flooded ;-)
dragotin commentedon Apr 24, 2025
Ah, yes, I let it run for a few days to give enough time (I hope) to assimilate all the files. But I have no clue if that has finished yet or not.
cscholz commentedon Apr 24, 2025
I've copied also a bunch of data on filesystem level. ~ 200 GB. My host system was with 8 cores busy for hours.
Also just waited and after 1-2 days the utilization was back to normal. I'm missing currently an option to see the indexing process of the files.
Created a feature request to see the posix indexing status of opencloud: #718
rhafer commentedon Apr 24, 2025
I'd suggest to open a separate issue for this. It's unrelated to the
auth-service's log entries.cscholz commentedon Apr 24, 2025
Thanks for the explanation. As the message was in my log presented in read a thought it could be an issue.
If it is just status message about a regular authentication than I agree that it should be visible on higher logging level
dragotin commentedon Apr 30, 2025
My home "server" still uses a lot of CPU with OpenCloud, even longer time after startup.
This is the htop profile:
I am considering that too much.
The log file scrolls through with accesses as described above. This is the excerpt for a single traceid:
Since this still looks like "something" is stating files, I'll continue to wait - if it is still assimilating the files that I copied into the file system I would expect it looks similar.
carlosjfcasero commentedon Apr 30, 2025
I'm having same issue after copying a large amount of GB. Mentioned logs appears every1-2 secs and CPU usage is high for days
dragotin commentedon May 2, 2025
Yes. Same here after days. This makes OpenCloud not useable for me, and it wastes a lot of compute.
Let's dig deeper. @aduffeck please help.
I straced the opencloud process with
strace -fp <pid>to understand what is causing the load. It seems that it tries tostatfiles that are not (longer) existing over and over again.The most files that are not existing on my machine, but tried to be stat'ed have the extension
.lockor.blksuch as:8 remaining items
rhafer commentedon May 9, 2025
Hm, from the nats docs (https://docs.nats.io/nats-concepts/subjects#subject-usage-best-practices):
I guess we'd be beyond the recommended 256 characters very quick. AFAICS we're already at 176 key length for a single resource id 😢
rhafer commentedon May 9, 2025
This is a pprof flame graph (for a 30sec interval) after copying 50000 1kB files manually into a space. File assimilation was already complete at this point. So you can see that the activitylog service is consuming roughly one half of the CPU time (and about a half of that is spent on JSON marshalling and unmarshalling). The rest of the CPU is spent mainly in the NATS server (not sure what it is doing there but
Sprintfshows up there pretty promiently) and in the garbage collector (sigh)This goes on for hours(!). Though I assume this is again because NATS starts to resend un-acked messages on the
activitylog.rhafer commentedon May 9, 2025
I did a small experiment in that direction: https://github.com/rhafer/opencloud/tree/issue/716
and now the graph looks like this:
So now the
activitylogconsumes just the tiny bit that is highlighted in that screenshot. And it was able to work of the event queue pretty quickly.rhafer commentedon May 9, 2025
Hm, this is because we enable trace logs for the nats server by default (https://github.com/opencloud-eu/opencloud/blob/main/services/nats/pkg/server/nats/nats.go#L35) 🤯
aduffeck commentedon May 12, 2025
That sounds attractive but has the problem that you'd have to rewrite lots of keys when a directory gets renamed.
I'm not sure if the added complexity is worth the effort.
aduffeck commentedon May 12, 2025
Did you also try to implement the reading part or was it just about benchmarking the writes? Hm, and I wonder how expensive it gets to maintain the limit of activities per resource.
I had two other ideas besides buffering the writes (which already gets rid of most of the load):
rhafer commentedon May 12, 2025
This was just the writing part. Reading does require some more work. We would need to add
Watch()support to the natkv go-mirco driver. Regarding the limit: The current limit of 6000 events per ResourceID was introduced because the values are too large. The suggested approach wouldn't have that issue. I guess we could just use some time based expiry.Btw, @butonic also commented, that the current implementation looses events as soon as more than a single activitylog instance in running.
[-]2 journalctl log entries per second start with [user idp:"none" ...][/-][+]Activitylog service creates endless load on the backend after uploading[/+]nats: Don't enable debug and trace logging by default
nats: Don't enable debug and trace logging by default
fschade commentedon May 12, 2025
I ran a few tests to see how it works with and without activity log and if there are any significant differences.
Result: no performance improvement without the activitylog service, the http_req_duration is a tiny bit shorter, but I would rather put that in the test deviation drawer
activitylog enabled
activitylog disabled
nats: Don't enable debug and trace logging by default