-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Performance degradation in google-api-core #16552
Copy link
Copy link
Open
Labels
api: corepriority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Determine this is the right repository
- I determined this is the correct repository in which to report this bug.
Summary of the issue
Context
Upgrading google-api-core from version 2.27.0 to 2.28.1 (and later) has caused a significant spike in CPU usage. While version 2.27.0 maintains a steady 20–40% utilization, versions 2.28.1 and above consistently reach 100% CPU consumption.
Expected Behavior:
Same consumption of CPU as in 2.27.0
Actual Behavior:
CPU consumption increased up to 5 times.
API client name and version
google-api-core v. 2.28.1 - 2.30.0
Reproduction steps: code
file: main.py
import time
import importlib
import google.api_core
time.sleep(5)
def test_api_core():
importlib.reload(google.api_core)
for _ in range(2000):
test_api_core()
print("Successfully imported 2000 times.")Reproduction steps: supporting files
file: Dockerfile
FROM python:3
WORKDIR /app
RUN pip install --no-cache-dir google-api-core==2.28.1 grpcio
COPY main.py .
CMD ["python", "main.py"]
Reproduction steps: actual results
docker stats:
2.30.0
2.27.0
Reproduction steps: expected results
OS & version + platform
No response
Python environment
No response
Python dependencies
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: corepriority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.