oraclecloud-sdk-patterns

Featured

Production-grade OCI SDK patterns for client lifecycle, retry logic, and memory leak avoidance. Use when building long-running OCI services, fixing memory leaks with Instance Principal auth, or implementing retry/backoff. Trigger with "oci sdk patterns", "oci retry", "oci memory leak", "oraclecloud client lifecycle".

AI & Automation 2,940 stars 439 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Oracle Cloud SDK Patterns ## Overview Production patterns for the OCI Python SDK that avoid the most common pitfalls: memory leaks from Instance Principal authentication (~10 MiB/hour if clients are recreated per request), missing retry logic for 429/500 errors, and timeout misconfiguration across different service clients. The OCI SDK has different timeout defaults depending on the service (Compute: 60s, Object Storage: 300s for uploads), and none of them set connection timeouts by default. **Purpose:** Provide correct client lifecycle (create once, reuse, close), exponential backoff retry, singleton patterns that prevent the Instance Principal memory leak, and per-service timeout configuration. ## Prerequisites - **Completed `oraclecloud-install-auth`** — valid `~/.oci/config` - **Python 3.8+** with `pip install oci` - Familiarity with OCI service clients (`ComputeClient`, `ObjectStorageClient`, etc.) ## Instructions ### Step 1: Singleton Client Pattern (Avoids Memory Leak) Instance Principal authentication allocates new security tokens on each client instantiation. Creating clients per-request leaks ~10 MiB/hour. Use a singleton: ```python import oci import threading class OCIClients: """Thread-safe singleton for OCI service clients. Prevents the Instance Principal memory leak by reusing clients instead of creating new ones per request. """ _lock = threading.Lock() _instance = None def __init__(self): self._config = oci.con...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category