If I have 10 functions that will use the same public library, can I upload a single copy of the library that my functions can share?

Updated at:
Copy as MD

No. Function code packages in Function Compute are independent — functions cannot share them. Each function scales independently based on its own workload. For example, a function handling 10,000 transactions per second (TPS) and one handling 100 TPS require very different resource scaling, so their packages stay separate.

To share a common library across functions, use one of the following approaches:

  • Layers: Package the shared library as a custom layer and attach it to any function that needs it. For setup instructions, see Create a custom layer.

  • Apsara File Storage NAS: Store the shared library in NAS and load it when your functions start.