The following are recommended best practices for using Azure Functions:
- It is desirable to have stateless code to effectively utilize the serverless concept.
- Keep functions short and simple. Create many short and simple functions rather than one big function.
- Import dependencies only if they are required. Consider module dependencies as well.
- Use storage queues, service bus queues, service bus topics, and event hubs for cross-functional communication.
- Delete functions that you are no longer using, especially if the function is hosted on the App Service plan in the basic, standard, or premium tier.
- Use the built-in monitoring of Function Apps to view and optimize request latencies or utilize Application Insights.