How to speed up shared folders

I experienced similar issues and would like to share my workaround:
https://gist.github.com/sveneisenschmidt/35e9c45e15c0f8d395e17a996415a669

For overcoming the slow file reads and writes of the application server I introduced a data container with lsyncd running. The lsyncd service takes care that all inner-container folders are updated with the recent changes from the mount. This leads to a lot faster application execution: 30ms versus 10s.

This solution is far from perfect, it should only be treated as a workaround for local application development and should never be used on production or staging servers.

Having a displaced vendor or cache/logs folder was no solution for me because it would introduce another layer, the solution with lsyncd is somehow intransparent to me and feels quite similar to the native version except you do not have slow file writes when the applications warms up the caches.

Another optimization one can do would let composer dump the optimized autoloader as well.

I am very optimistic about the Docker people fixing this problem and I can live with a sync container for some time.

4 Likes