Trackio uses a non-blocking, queue-and-batch architecture designed to prevent logging from slowing down your training loops.
Local Logging
trackio.log() is a non-blocking call. It appends data to an in-memory queue and returns immediately. A background thread drains this queue every 0.5 seconds and writes the data to a local SQLite database. This allows for effectively unlimited client-side throughput (thousands of calls per second) without impacting the main execution thread.
Logging to Hugging Face Spaces
When a space_id is provided, the background thread batches queued entries and pushes them to the Space via the Gradio client API.
Performance Characteristics:
- Burst Performance: ~2,000 logs can be delivered in < 8 seconds.
- Parallelism: Multiple threads (e.g., 32 threads) can run in parallel, each opening its own Gradio client connection. 32,000 logs can be delivered in ~14 seconds wall time.
- Batching: There is no hard cap on logs per batch; all entries queued during a 0.5s interval are sent in a single
predict() call. - Data Safety: Trackio provides zero-loss guarantees. If a batch fails to send (e.g., due to network issues), the data is persisted to the local SQLite database and retried automatically once the connection is restored.
Note: Trackio is designed defensively. Failures in logging, flushing, or delivery paths should degrade to warnings and local buffering rather than raising exceptions that crash your training code.