-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefer copying files over linking #6
Comments
Though this change, everything is copied except for the dumped container. I already tested it with #10 and it increases the startup time from 82ms to 162ms. The entire first request takes 1228.13ms + 306.20 ms init time so it isn't the biggest difference.
As mentioned in #12:
So actually copying everything should be avoided if possible
But there might be other options that work similar to overlayfs which would in 1 swup fix all possible problems since there is not symlinkung, no changing of a directory and everything would be writable without any copying at the start.. |
Hm, Im not sure I have any valuable input. But here are some goals I think we should focus on:
I am okey that special use cases are for advanced users as long as it is easy for most people. |
Maybe a streamwrapper is a way forward. Basically, register before each file lookup to rewrite the path if the file exists in symfony var/cache but not in the original path. if (substr($path, 0, 10) !== '/tmp/cache') {
return;
}
if (file_exists($path)) {
return;
}
$pathToFileInSymfonyVarCache = ...
if (file_exists($pathToFileInSymfonyVarCache)) {
return $pathToFileInSymfonyVarCache;
} |
I tried streamwrappers by using https://github.com/brzuchal/filesystem-stream-wrapper and modifying it slightly so i can add multiple paths. Result: It doesn't work with errors like these:
Then I tried the way I didn't expected not to work. In boot, I simply do this: $lowerdir = $this->getProjectDir() . '/var';
$upperdir = '/tmp/var';
if (! is_dir($upperdir)) {
mkdir($upperdir);
shell_exec("mount -t overlayfs -olowerdir=$lowerdir,upperdir=$upperdir $lowerdir");
} And what can I say? It works perfectly. |
Through this change I made the entire /var folder writable without needing to copy anything. It'll even work with all bundles that somehow write into the var folder since there is no detectable difference to a real writable folder, even when accessed though command and overlayfs is heavily tested since it is one of the core components of docker.
Through this change I made the entire /var folder writable without needing to copy anything. It'll even work with all bundles that somehow write into the var folder since there is no detectable difference to a real writable folder, even when accessed though command and overlayfs is heavily tested since it is one of the core components of docker.
So mounting a filesystem does not work. Streamwrappers may seam like it is overkill (and we had a hard time making it work). Copying files are super slow as shown in #18. I suggest closing this issue. |
Probably true. The current solution is a good compromise of cold start time and stability. I could imagine reconfiguring the containers system cache to use a custom FileAdapter that handles the overlay logic but that would only work if the cache is properly warmed so it would trade stability. |
My initial code prefers symlinking as much as possible.
The performance advantage of that is minimal while it might make problems if the cache is not properly warmed.
Therefore it is probably best to copy everything that does not need to be in the original
var
folder, the overhead should be minimal.The text was updated successfully, but these errors were encountered: