cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

MLFlow connection pool warning

Sam
New Contributor III

Hi,

I have a transformer model from Hugging Face I have logged to MLFlow.

When I load in using 

mlflow.transformers.load_model
 
I receive a bunch of warnings: WARNING:urllib3.connectionpool:Connection pool is full, discarding connection: xxxx. Connection pool size: 10
 
Any ideas what is going on here and how to solve? Is this causing the model load to be slow?
1 REPLY 1

Kaniz
Community Manager
Community Manager

Hi @Sam, The warnings youโ€™re encountering are related to urllib3, which is a Python library for handling HTTP connections.

Letโ€™s break down the issue and explore potential solutions:

  1. Connection Pool Warnings:

    • The warning message indicates that the connection pool (used for managing reusable connections) is full, and a new connection is being discarded.
    • This can happen when your code is making multiple HTTP requests (such as downloading model files) concurrently, and the pool reaches its maximum capacity.
    • The pool size is set to 10 in your case.
  2. Possible Causes:

    • Concurrency: If youโ€™re loading multiple models or making other HTTP requests simultaneously, it can lead to connection pool exhaustion.
    • Resource Limitations: Insufficient system resources (such as memory or file descriptors) can also cause this issue.
  3. Solutions:

    • Increase Connection Pool Size:

      • You can try increasing the connection pool size to accommodate more concurrent connections. However, be cautious not to set it too high, as it may strain system resources.
      • Example (if using requests library):
        import requests
        from requests.adapters import HTTPAdapter
        
        session = requests.Session()
        adapter = HTTPAdapter(pool_connections=20, pool_maxsize=20)
        session.mount("http://", adapter)
        session.mount("https://", adapter)
        
    • Optimize Model Loading:

      • If youโ€™re loading multiple models, consider loading them sequentially rather than concurrently.
      • Use lazy loading (load only when needed) to reduce the initial resource overhead.
      • Cache models locally to avoid repeated downloads.
    • Check System Resources:

      • Ensure that your system has sufficient resources (RAM, file descriptors, etc.) to handle concurrent connections.
      • Monitor resource usage during model loading.
    • Upgrade Libraries:

      • Make sure youโ€™re using the latest versions of mlflow, transformers, and other relevant libraries.
      • Some older versions may have known issues related to connection pooling.
  4. Impact on Model Load Time:

    • While connection pool warnings themselves donโ€™t directly impact model loading speed, they can indirectly affect it.
    • If connections are being discarded and re-established frequently, it may slow down the overall process.
    • Addressing the warnings should improve the overall efficiency of your model loading.

Remember to adapt the solutions based on your specific use case and system configuration. If you continue to experience issues, consider seeking help from the Hugging Face community or check...12.