Databricks interview question

Implement a file writing function that maximizes throughput while minimizing latency and guaranteeing file durability.