Closed mpenkov closed 1 month ago
Hello @mpenkov , Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.
Hello @mpenkov 👋, The performance differences you've observed between your local environment and GitHub Actions (GHA) can be influenced by several factors:
Hardware Differences: Variations in CPU, memory, and disk speed between the local environment and GHA runners can significantly impact performance.
Operating System and Configuration: The underlying operating system and its configuration, including system overheads and background processes, can affect application performance.
Execution Environment: Differences in runtime versions (e.g., Python, Go), environment variables, and the presence of different system libraries can lead to performance variations.
To provide a clearer example, I've attached screenshots of my macOS local environment setup and the macOS-13 GHA configuration:
Local Environment:
GHA:
I hope this clarifies the situation.
Hi @priyagupta108 , thank you for looking into this.
I think you may be misunderstanding the problem because your explanation focuses on the execution environment. The point isn't to run the shared library on GHA. The point is to build the shared library on GHA, and then to use the shared library in the production environment.
The issue demonstrates that there is something wrong with the way that GHA is building the shared library. If I try to use the shared library built by GHA, it is very slow. If I replace the shared library built by GHA with one that I built somewhere else, then it is no longer slow. Therefore, the problem is with GHA.
EDIT:
I've updated my example code to also use the macos-latest runner. I can confirm that the problem does not appear with the macos runner, which is consistent with the results that you posted.
Therefore, we can narrow the problem down further: the problem is with the build environment on the GHA Ubuntu runner.
Hi @mpenkov 👋 ,
Could you please provide the Go version installed in your local environment (use go version
to obtain this).
This information will help us investigate the performance difference between the shared libraries built on GitHub Actions and local machine.
Thank you!
$ go version
go version go1.21.4 linux/amd64
Hi @mpenkov, After further investigation, I've identified a performance issue related to Go versions released from 2024-07-02 onwards. On Ubuntu environments, the execution time is notably longer with these versions compared to those released before this date. Please find the test results below: Versions from July 2, 2024, onwards:
go1.23.1:
go1.22.5:
Versions released before July 2, 2024:
go1.22.4:
go1.21.4:
I recommend setting a Go version released before July 2, 2024, such as 1.21.4, in the GitHub Actions workflow to observe the performance difference.
Good catch! So this is a problem with the go utility itself, and not Github Actions?
This seems relevant: https://github.com/golang/go/issues/68587
Thank you! Yes, this is an issue with the Go utility itself. The https://github.com/golang/go/issues/68587 issue you referenced is relevant and might be worth following for any updates or potential fixes from the Go team. Closing this issue for now. Please feel free to reach out to us in case of any concerns.
Description:
I've identified a problem with building shared libraries from Go source using Github Actions.
The library source contains a single function, called cNoop, which does nothing. I then build this library into a shared object using Github Actions. The workflow is here. Nothing fancy, just a
go build -buildmode=c-shared
.The problem is that the resulting shared object is extremely slow to use. Calling the cNoop function 1 million times from e.g. Python takes nearly 30s.
In contrast, if I build the shared object locally on my machine, the same task (1 million calls to cNoop) takes a fraction of a second.
Minimum reproducible example is here.
Action version:
5
Platform:
Runner type:
Tools version:
1.23.0
Repro steps:
https://github.com/mpenkov/go-shared
Expected behavior:
The shared object should be reasonably fast to use. Here's an example of a shared object that I built locally:
Actual behavior:
The shared object built using Github Actions is extremely slow (up to 100 times slower).