Reputation: 2429
I have a CentOS guest running in virtualbox. It runs apache and django. All my django website source files are in a windows host directory. I mounted this directory in CentOS. The file system is vboxsf.
The problem is, when I access the guest Apache url in windows host browser, It loads very slow. I mean the browser waiting time is around 17 seconds before the page load.
To investigate this, I used python profiling and I'm not able to find the issue using this profiler data. Please find below the profiler data.
ncalls tottime percall cumtime percall filename:lineno(function)
578 4.300 0.007 7.650 0.013 /usr/local/python2.7/lib/python2.7/zipfile.py:755(_RealGetContents)
345837 1.146 0.000 1.520 0.000 /usr/local/python2.7/lib/python2.7/zipfile.py:277(__init__)
1383348 0.752 0.000 0.752 0.000 {method 'read' of 'cStringIO.StringI' objects}
578 0.560 0.001 9.182 0.016 build/bdist.linux-x86_64/egg/pkg_resources.py:1452(build_zipmanifest)
347095 0.417 0.000 0.417 0.000 {_struct.unpack}
575 0.285 0.000 9.738 0.017 build/bdist.linux-x86_64/egg/pkg_resources.py:887(resource_stream)
345837 0.273 0.000 0.273 0.000 /usr/local/python2.7/lib/python2.7/zipfile.py:368(_decodeExtra)
345837 0.258 0.000 0.401 0.000 /usr/local/python2.7/lib/python2.7/zipfile.py:854(getinfo)
769042 0.248 0.000 0.248 0.000 {method 'append' of 'list' objects}
345906 0.212 0.000 0.212 0.000 {method 'find' of 'str' objects}
345837 0.207 0.000 0.207 0.000 /usr/local/python2.7/lib/python2.7/zipfile.py:362(_decodeFilename)
346850 0.205 0.000 0.205 0.000 {method 'replace' of 'str' objects}
578 0.204 0.000 0.292 0.001 /usr/local/python2.7/lib/python2.7/zipfile.py:822(namelist)
2579/621 0.173 0.000 0.363 0.001 /usr/local/python2.7/lib/python2.7/sre_parse.py:379(_parse)
345957 0.162 0.000 0.162 0.000 {chr}
356098 0.153 0.000 0.153 0.000 {method 'get' of 'dict' objects}
22293 0.084 0.000 0.096 0.000 /usr/local/python2.7/lib/python2.7/sre_parse.py:182(__next)
600 0.080 0.000 0.080 0.000 {method 'get_data' of 'zipimport.zipimporter' objects}
3896/608 0.071 0.000 0.193 0.000 /usr/local/python2.7/lib/python2.7/sre_compile.py:32(_compile)
1 0.068 0.068 0.068 0.068 /usr/local/python2.7/lib/python2.7/site-packages/celery-3.0.16-py2.7.egg/celery/backends/base.py:15()
578 0.056 0.000 9.291 0.016 build/bdist.linux-x86_64/egg/pkg_resources.py:1490(__init__)
5054/1785 0.052 0.000 0.062 0.000 /usr/local/python2.7/lib/python2.7/sre_parse.py:140(getwidth)
894 0.052 0.000 0.806 0.001 /usr/local/python2.7/lib/python2.7/re.py:226(_compile)
608 0.052 0.000 0.143 0.000 /usr/local/python2.7/lib/python2.7/sre_compile.py:361(_compile_info)
1287 0.040 0.000 0.083 0.000 /usr/local/python2.7/lib/python2.7/sre_compile.py:207(_optimize_charset)
1 0.039 0.039 0.060 0.060 /usr/local/python2.7/lib/python2.7/site-packages/ZSI-2.1_a1-py2.7.egg/ZSI/wstools/WSDLTools.py:10()
37496 0.039 0.000 0.039 0.000 {isinstance}
383/164 0.038 0.000 11.982 0.073 {__import__}
1 0.037 0.037 0.190 0.190 /usr/local/python2.7/lib/python2.7/site-packages/ZSI-2.1_a1-py2.7.egg/ZSI/__init__.py:6()
575 0.036 0.000 9.841 0.017 /usr/local/python2.7/lib/python2.7/site-packages/pytz-2012h-py2.7.egg/pytz/__init__.py:84(open_resource)
5 0.032 0.006 0.032 0.006 {method 'commit' of '_mysql.connection' objects}
3 0.031 0.010 0.033 0.011 /usr/local/python2.7/lib/python2.7/site-packages/django/core/cache/backends/memcached.py:153(__init__)
I thought shared file system is causing the problem, so I just copied the entire code base to CentOS guest locally but, again I get same performance issue.
Any help would be appreciated. Thank you.
EDIT: Guest spec
OS: CentOS 5.8
RAM: 2GB
STORAGE: 10GB Dynamically allocated.
Upvotes: 0
Views: 510
Reputation: 83418
The problem is Windows host directory.
When you request a file from Apache it will most likely fork a new UNIX process which need to load the whole Python + Django stack to memory. Doing this roundtrip file system reads over SMB networked file system from Windows partition which is very expensive.
My suggestion is to have all files inside the guest OS and that should bring up speed up a lot.
Alternative ditch Windows altogether and run your whole development environment inside the guest OS.
Upvotes: 1