

- #Docker on mac performance mac osx#
- #Docker on mac performance install#
- #Docker on mac performance Patch#
#Docker on mac performance Patch#
An OPTIONS (CORS) request (to see if the action is allowed) and the GET / POST / PATCH etc request (the actual action) and if your application is handling the OPTIONS request then you have a delay as a result of passing the request over to PHP and PHP booting up the framework etc to process the request. If your application is being accessed via an AJAX request then there are 2 requests that are being made. Unless you have specific needs, just enabling opcache should be enough Configuring Nginx to handle OPTIONS requests
#Docker on mac performance install#
RUN apt-get update & apt-get install opcache -y You can add this to your Dockerfile in a similar way to below FROM php:7.4-fpm The PHP docker image doesn't have opcache enabled by default. Note: If your application is an API that is accessed via an AJAX request, you could be affected by this delay twice, once for the preflight (OPTIONS) request and again for the GET / POST request, so this change could save you around 10 seconds overall per AJAX request. I could then see that the cURL request to were resolving quickly as expected. Once I added the IPV6 mapping into my /etc/hosts file, like below, 127.0.0.1 This turned out to be due to attempts to resolve the hostname via IPV6 and I'd only defined the IPV4 mapping in /etc/hosts file.
#Docker on mac performance mac osx#
In my case, I was running this on Mac OSX and localhost and returns in a few milliseconds but has a 5-second delay. Now we can test if there are any DNS resolution issues by timing the requests. With this running, we can make a request to or or ) and we should be presented with the default "Welcome to nginx!" page. Next, I spun up a standard nginx docker container so there was some content being served for our test cURL request to receive. I was suspecting performance issues with and I set up as an alternative mapping to see if the issue was isolated to the. With these set up, localhost, and will all resolve to 127.0.0.1.
:max_bytes(150000):strip_icc()/Dockiconannotated-fa0989566ec147639a1b5ce290c02032.jpg)
To try and identify the root cause, I created some sample entries in the /etc/hosts file to test with i.e. In my case, I traced the DNS resolution issues down to the use of a.

