I move both my Site Root(defined at MT publishing settings) and DataSource path(defined at mt-config.cgi) of MT to my Ramdisk, R:\.

That means It's no longer need to access hdd while building sites. It just accesses the Ram. With a test, the speed for building site or building an entry has a dramitic increase, from over 20 mins reduce to 3"50' for rebuilding whole site, and from 2-3 mins reduce to 25s for adding a new entry in my Thinkpad.

The data in Ramdisk will lost after a reboot, I write a .bat file to init the data in Ramdisk and save changes from Ramdisk to hdd.

More about the .bat file please continue to read.

 

SetSites.bat

if not exist "%TEMP%\SetSites.exclude" (
echo \mt-static\>"%TEMP%\SetSites.exclude"
echo \ref\>>"%TEMP%\SetSites.exclude"
echo .lock>>"%TEMP%\SetSites.exclude"
)

if not exist "R:\SITE\BLOG.ALEX.COM\WWW" (
md "R:\SITE\BLOG.ALEX.COM\WWW"
xcopy /E /H /K /EXCLUDE:%TEMP%\SetSites.exclude "E:\CMS\PERSONAL\SITE\BLOG.ALEX.COM\WWW\*" "R:\SITE\BLOG.ALEX.COM\WWW\*"
)

if not exist "R:\SITE\mt-db" (
md "R:\SITE\mt-db"
xcopy /E /H /K /EXCLUDE:%TEMP%\SetSites.exclude "E:\CMS\PERSONAL\SITE\mt-db\*" "R:\SITE\mt-db\*"
)

if not exist "R:\SetSitesBack.bat" (
echo if not exist "E:\CMS\PERSONAL\SITE\mt-db" md "E:\CMS\PERSONAL\SITE\mt-db">>R:\SetSitesBack.bat
echo xcopy /E /H /K /C /Y /R "R:\SITE\mt-db\*" "E:\CMS\PERSONAL\SITE\mt-db\*">>R:\SetSitesBack.bat

echo if not exist "E:\CMS\PERSONAL\SITE\BLOG.ALEX.COM\WWW" md "E:\CMS\PERSONAL\SITE\BLOG.ALEX.COM\WWW">>R:\SetSitesBack.bat
echo xcopy /E /H /K /C /Y /R "R:\SITE\BLOG.ALEX.COM\WWW\*" "E:\CMS\PERSONAL\SITE\BLOG.ALEX.COM\WWW\*">>R:\SetSitesBack.bat
)

SetSites.exclude

\mt-static\
\ref\
.lock

The .bat file will generate a .bat file for saving changes back to hdd which is located at the root of Ramdisk.

SetSitesBack.bat

if not exist "E:\CMS\PERSONAL\SITE\mt-db" md "E:\CMS\PERSONAL\SITE\mt-db"
xcopy /E /H /K /C /Y /R "R:\SITE\mt-db\*" "E:\CMS\PERSONAL\SITE\mt-db\*"
if not exist "E:\CMS\PERSONAL\SITE\BLOG.ALEX.COM\WWW" md "E:\CMS\PERSONAL\SITE\BLOG.ALEX.COM\WWW"
xcopy /E /H /K /C /Y /R "R:\SITE\BLOG.ALEX.COM\WWW\*" "E:\CMS\PERSONAL\SITE\BLOG.ALEX.COM\WWW\*"

There's some folders and files in Site Root it's not expected to be moved out and back for some reason, such as large size or so. I exclude these folders and files by SetSites.exclude. Also I got following changes upon above issues.

re-map the excluded folder in Apache.

Oraginal httpd.conf

NameVirtualHost 127.0.0.1
# VirtralHost for Private Blog
<VirtualHost 127.0.0.1>
ServerAdmin alexzhangs@gmail.com
DocumentRoot E:/CMS/PERSONAL/SITE/BLOG.ALEX.COM/WWW
ServerName blog.alex.com
ErrorLog logs/blog.alex.com-error_log
CustomLog logs/blog.alex.com-access_log common
</VirtualHost>

Changed httpd.conf

NameVirtualHost 127.0.0.1
# VirtralHost for Private Blog
<VirtualHost 127.0.0.1>
ServerAdmin alexzhangs@gmail.com
#DocumentRoot E:/CMS/PERSONAL/SITE/BLOG.ALEX.COM/WWW
DocumentRoot R:/SITE/BLOG.ALEX.COM/WWW
ServerName blog.alex.com
ErrorLog logs/blog.alex.com-error_log
CustomLog logs/blog.alex.com-access_log common
Alias /mt-static/ "E:/CMS/PERSONAL/SITE/BLOG.ALEX.COM/WWW/mt-static/"
Alias /ref/ "E:/CMS/PERSONAL/SITE/BLOG.ALEX.COM/WWW/ref/"
</VirtualHost>

mt-config.cgi

#DataSource  E:/CMS/PERSONAL/SITE/mt-db
DataSource R:/SITE/mt-db

Also changed the Site Root in MT publishing settings.

Post a comment

mail.png


相似文章|Related Entries

最近更新|Recent Entries

不定期更新|Handy Entries

相似标签|Related Tags

分类栏目|Categories

按月归档|By Month

2008
01
2007
12
10
07
06
05
04
03
02
01
2006
12
11
10
09
08
07
06
05
04
03
02
01
2005
11
10
09
08
07
04
03
2004
12
11
10
09
08
07
06
05
04
03
02
01
2003
12
10
09
08
06
2002
09
08
04
03
02
2001
12
09
07
06
05

站内链接|Site Links

Powered by
Movable Type 3.34