2007年11月13日随笔档案烦恼岁月

参加工作也已经5年多了,一直想回头回想一下自己,然后动笔写下来,一来是自己目前还可以记忆起一些事情,等自己将来老了,可以看看这些东西回忆回忆。二来也是想做一个总结。本来这个题目也可以叫做我的bmi5年,不过大家知道bmi的实在是少,而且现在这个公司已经名义上不存在了。

我是在2001年去沈阳读书的,一直也是很喜欢沈阳的气候和东北人的豪爽,东北爷们是真正可以拿心和你交朋友的,不过我实在不喜欢东北的饮食,觉得不细腻,另外南方还有我的女人在等我回去,要女人来东北,难度不是一般的大,所以在找工作的时候,我就下定决心一定要找南方的公司,最好广州,深圳的,或者老家南昌的也是可以的。但是南方公司去东北招生的实在是少,除了华为,中兴之外真的是少的可怜,尽管我们学校在沈阳也是数一数二的学校。

在04年在10月份,我面试的第一家公司是东软,没有办法,谁让我们学校是东软的最大股东尼(不知道现在是不是),面试的过程也还不错,考试题也做的很顺,东软还提出我们下学期直接找一些外教来教我们日文,不过当时东软给出的薪水实在是低的可怜,只有1800元,而且还要自己负责住宿,自己当时也老大不小了,还有女人在读书,是不是也是需要买些礼物的,而且沈阳和大连都不是我想去的地方,结果就直接没有去报道。

最近在看一些项目的代码,总是发现很少项目提供出uml图,或者就是提供uml图的也有可能并没有和代码对应上,如果有正确的uml图,可以非常方便的为大家更好的理解代码层次逻辑。其实我们可以使用使用UMLGraph来生成uml图,直接使用java代码来生成UMLGraph。对于大部分项目来说,我们一般使用maven和ant(还在使用ant,你out了)来作为项目的编译工具。

在maven中,我们可以在pom.xml增加:

尽管工作了5年多了,现在能想起来的培训真的是少之又少,但是我想以后,我一定不会这样说了,因为我参加了百支了!

百支对于我来说是一次清洗,洗掉以前的恶习,洗掉以前的老思维,重新培养我丢掉已久的价值观,重新找回往日的激情。来阿里之后,也一直在想一个问题,阿里和我以前公司有什么不同?或者说有什么特别的之处?其实这个问题有很简单,就是阿里是一家有梦想的公司,一家有价值观的公司,一家有亲情,友情的公司,一家工作生活一体的公司,从中国来看,阿里是唯一一家大的公司,而且价值体系贯彻的这么好的公司,onlyoneinchina。

百支培训了很多业务知识,传统线,虚拟线,兄弟线,安全线,资金线,…学到了很多东西。

百支的培训,让我开始结识了新的同学,新的家人,新的伙伴,让我们happlyeveryday!认真工作,快乐生活!

随着网络技术的发展,很多恶意程序往往按照常规方法无法彻底删除。有没有什么方法能够在不安装任何第三方工具的情况下,删除它们呢?笔者经过多年实践,告诉大家一个秘密武器--关闭Explorer进程法。在服务器系统出现问题时,例如某个文件无法删除,某个程序假死或者是系统没有响应都可以按CTRL+SHIFT+ESC,调出Windows任务管理器。接下来找到“进程”标签,将“explorer.exe”进程关闭。接下来整个桌面就会消失,只剩下桌布了。然后通过Windows任务管理器的“文件”菜单下的“新建任务(运行)”打开“创建新任务”窗口,通过“浏览”按钮找到要删除文件所在目录,在浏览窗口里直接删除即可。99%都可以将这个顽固的文件删除,删除后继续选择“文件”菜单下的“新建任务(运行)”打开“创建新任务”窗口,在打开处输入命令--explorer后回车,我们将返回到正常的桌面界面下。显然,对付顽固文件,这个方法尤为简单。

trueorfalseforwhetherthisrepositoryisenabledfortherespectivetype(releasesorsnapshots).

Thiselementspecifieshowoftenupdatesshouldattempttooccur.MavenwillcomparethelocalPOMstimestamptotheremote.Thechoicesare:always,daily(default),interval:X(whereXisanintegerinminutes)ornever.

WhenMavendeploysfilestotherepository,italsodeployscorrespondingchecksumfiles.Youroptionsaretoignore,fail,orwarnonmissingorincorrectchecksums.

Intheabovedescriptionofrepositories,itwasmentionedthattheyallfollowacommonlayout.Thisismostlycorrect.Maven2hasadefaultlayoutforitsrepositories;however,Maven1.xhadadifferentlayout.Usethiselementtospecifywhichifitisdefaultorlegacy.IfyouareupgradingfromMaven1toMaven2,andyouwanttousethesamerepositorywhichwasusedinyourMaven1build,listthelayoutaslegacy

therearelotstoolsaboutthejavaobfuscate.Iknowtwo.

(1)proguard

(2)yguard

theproguardsupportant,maven.Iusemavenastheprojectandbuildtools.soIwantusethemavenproguardplugin,butItisnoteasytouse.soIuseyguard.

inyourpom.xml,youcanadd:

有个大师说过一句话,有人的地方就有江湖,有江湖的地方就有斗争。今天在javaeys就看到了一场Resourcebundle引起的口角,集体见:

这个问题在jdk1.6已经不存在

在1.5,1.4怎么办呢:

今天是伟大的甘地的生日,刚好在印度出差也就享受了一天假期,不过如果我在国内的话今天也是不上班了,因为今天是伟大祖国生日的第2天。

今天继续在搞weblogic和jetty的调试,发现一个问题,weblogic会对response中的内容trim,jetty不会。估计是ebos中有一段代码在response的out里面写了一些空白进去,导致这个内容到client端的时候就会解析不对。obj.responseXML会是空。

另外,Fiddler是监控网络连接的,一般的话它会监控有线的那个,我在酒店是使用无线上网,所以一开始找不到原因还以为是fiddler不支持无线方式的监控,查看了一下配置才发现问题。

最后实在没有办法直接写死,好在我做的只是一个开发辅助工具,不需要考虑性能影响:

varxmlData=obj.responseText.trim();//alert(xmlData);obj.responseXML.loadXML(xmlData);明天继续完善程序,争取在这个假期完成之前能完成大体,后续文档补充。也算是功德一件了。

出国有很多好处也有很多坏处,这里就说一处好处,就是可以为自己的历史课好好的补一补了。历史以成败论英雄,当权者一般都会去篡改历史的,不过在长久看来,大家都不过是历史的一粒沙尘,是无法改变历史的,人只能创造历史,无法修改历史。在中国内地的当代史就是一部篡改的历史,所以这次出国就好好的补了补,在国外很多网站都可以访问,使用google可以查任何你想要查的东西,不会过滤掉一些关键的信息。

下面我就来说说我对近代一些人物的再认识吧:

先说蒋先生,其实这个人的功劳应该是很大的,我个人觉得比先祖的功劳要大,毕竟统一了中国,而且在台湾也实现了一定程度的民主。尤其的是在8年抗战的历史上更是不能抹去的功绩,历史应该给蒋先生一个公道。

张学良,这个人的爱国程度超出我原来的影响,以前的历史书上也是说张学良是千古功臣,但是说的很含糊,尤其是在D的丰功伟绩下显得不是伟大,张学良这个人不仅仅是爱国,而且这个人的心胸非常的大,他让蒋先生关了后半辈子,看采访他的是很,他也只是一笑而过,当然这个或者是他后来是基督教有关。

蒋夫人,不愧是中国的第一夫人,如果有人问我中国的第一夫人是谁?很茫然,是胡夫人吗?她做了一些啥?看看人家蒋夫人在抗战时候做的事情,抗战后方支援,美国国会演讲,国际场合的外交,真的不愧是第一夫人,不过对这个,我了当代历史说的就更加的少了。

毛太祖,看他在建国后的人大会议上,俨然就是一个皇帝,虽然他本人非常的亲民,而且一直也是爱民如子,不过他错过了历史给他的机会,如果他能学一下华盛顿,为中国留下一个比较完善的制度,我看今天的中国应该会更加富强了。非常可惜,强人政治的时候没有推进民主,在后强人政治就只是剩下了利益斗争了。

今天看一段网上录像,说小平同志还跟过冯玉祥。历史课本上貌似没有这个。

大概在4年前,我还在沈阳做辽宁网通的boss项目,那个时候系统刚刚上线,问题成堆,尤其是一些单子由于程序或者是数据问题,出现异常,出现异常就必须去更正数据,让单子继续走下去。那个时候公司有个强人,使用Python来做这个事情,说白了也是比较简单,就是使用Python调用server端得ejb,修改数据然后提交到server上去。不过在那个时候懂一门动态语言在我看来非常的不简单。

goon,最近闲的无事,把同事的一个程序拿过来修改了一下,大概也是实现了这样的一个逻辑,不过没有使用Python,orJython,使用的是java程序员都很熟悉的Beanshell语言来写,并添加上了SWT,作为ui。这样对公司大部分人就没有什么难度了,直接可以写java代码,而且没有Jython那样格式的严格要求(很烦人)。

先上一下图:

结果后台配置,就可以直接修改,查看server上的数据,如果有问题的单子还可以通过这个来修改,非常cool。

怎么做到这点呢:

(1)通过java调用beanshell的方法,init一个init.bsh,在这个bsh里面写上你自己的逻辑,比如lookupejb,写好一些方法,这样使用者就直接可以调用了。

(2)把一些服务器的配置写到配置文件里面去。

如果修扩展,也很简单,直接修改一下配置文件,添加一些jar并在init.bsh里面添加自己的逻辑就可以了。

昨天晚上就抵达了india的hyderabad,一个发展中的城市,在这个城市你可以看到90年代在珠三角的样子,所以至少来讲,india还是落后中国20年,当然我们中国也是和谐的比较厉害,这个我们还是需要承认的。

到酒店一看,才知道原来这样的地方也敢叫hotel,真是人有多大胆地就有多大产!不服不行啊。从公路上来看india的话,小车和bus比较多,当然更多的是那个三轮摩托他们叫auto,想多的多,而且有一些还是2个人开,非常好奇的是难道一个车还要2个人合伙?更奇怪的是india的bus的门貌似都不关,不管是schoolbus还是companybus,都一样不关门,开的飞快。也不知道他们的车做门做啥。可惜的是,这次出来没有带照相机,要不照照给大家看看。

吉隆坡还是一个非常漂亮的city,如果坐飞机去这个城市的话,晚上到,飞机回经过kul的上空,你可以看这个city的全景,可以看双子塔,当然和上海市没有的比。

office还是不错,非常的大,而且有tearoom,非常的不错。中午去了一趟office的食堂,中午食堂:2个咖喱搞的汤(alittle),一个鸡蛋,还有一些油炸食品。吃不下,同事介绍说附近有一个shanghaichef,打个auto跑过去(taxi就打不到)才发现,全是假冒的,一点也不是Chinesefood。

出差india,苦啊!

inwindows,wecaninstallweblogicaswindowsservice.

(1)editbea.home/wlserver_10.3/server/bin/installSvc.cmd

add:

rem设置域的名字,这里是base_domainsetDOMAIN_NAME=wsc52rem服务名setSERVER_NAME=AdminServerrem设置用户domain的homesetUSERDOMAIN_HOME=D:\bea10\user_projects\domains\wsc52rem设置口令setWLS_pw=weblogicsetJAVA_HOME=D:\bea10\jdk160_05addinthefinalline,add

#test*表示了div里面所有元素,当然包含了span,input,img这些内联元素了。

vertical-align初始值:baseline(缺省值)可否继承:否适用于:内联元素说明:vertical-align:baseline使元素的基线同父元素的基线对齐.警告:vertical-align不能影响表格单元中的内容的对齐,对于块元素中的内容也一样.请注意,vertical-align只影响内联元素,比如span,img,em,input,a等这些元素,而对div,h3,p等这些块元素是无效的.

Maveisgoodatjarmanagement.somavencanhelpmetopackagethejavaapplication.withmavenhelp,wecanmakethereleaseapplicationzipsmaller.

forthesmaller:weusethemavenanttasktomanagerjars:

build.xml

sowecanusemaventoupdateyouapplication.

asweknowmavencanmanageryoujars,Iammavenfuns,Mavencangivemelotsofgoodidea.Comparewithant.

(1)noclasspathproblem.

SometimesManyuseofantcomplainedbecauseofclasspath.Theycannotdirectknowwhichjarstheyusedinproject,almostversion.

(2)lotsofplug-intousewithmaven.(maven-jetty-plug-in)

(3)mavenreportisusefullyforimproveyoucode.

(4)manageryourjarofapplication.

(5)goodforteam.

(6)easytouse.

Aboutthispoint,userofantdonotagreewithme.butithinkmaveneasytouse,youdonotneedtocareclasspath,youcaneasilytogetallreport.

asweknow,inweblogic10.theweblogic.jarjusthasmorethan30MB.soifyouwantusetheclienttoinvokeweblogicejbmethod,youneedtheweblogic.jar.ofcourse,ifyouusetheweblogic9,itworkwell,butwhenyouupgradeyourweblogicservertoweblogic10.theweblogic.jardoesnotwork.theweblogic.jaroftheweblogic10isnotenough.

youneeddonext:

Usethefollowingstepstocreateawlfullclient.jarfileforaclientapplication:

Changedirectoriestotheserver/libdirectory.cdWL_HOME/server/libUsethefollowingcommandtocreatewlfullclient.jarintheserver/libdirectory:java-jar../../../modules/com.bea.core.jarbuilder_X.X.X.X.jarwhereX.X.X.XistheversionnumberofthejarbuildermoduleintheWL_HOME/server/libdirectory.Forexample:

java-jar../../../modules/com.bea.core.jarbuilder_1.0.1.0.jarYoucannowcopyandbundlethewlfullclient.jarwithclientapplications.Addthewlfullclient.jartotheclientapplication’sclasspath.

example:

web.xml

参考:manvi和vi–help

Oftentimesyouwillhave3rdpartyJARsthatyouneedtoputinyourlocalrepositoryforuseinyourbuilds.TheJARsmustbeplacedinthelocalrepositoryinthecorrectplaceinorderforittobecorrectlypickedupbyMaven.Tomakethiseasier,andlesserrorprone,wehaveprovideagoalintheinstallplug-inwhichshouldmakethisrelativelypainless.ToinstallaJARinthelocalrepositoryusethefollowingcommand:mvninstall:install-file-Dfile=-DgroupId=\-DartifactId=-Dversion=-Dpackaging=forexample:

mvninstall:install-file-Dfile=jazzy-core-0.5.2.jar-DgroupId=jazzy-core-DartifactId=jazzy-Dversion=0.5.2-Dpackaging=jar

ResultSet接口提供用于从当前行获取列值的获取方法(getBoolean、getLong等)。可以使用列的索引编号或列的名称获取值。一般情况下,使用列索引较为高效。列从1开始编号。为了获得最大的可移植性,应该按从左到右的顺序读取每行中的结果集列,每列只能读取一次。对于获取方法,JDBC驱动程序尝试将底层数据转换为在获取方法中指定的Java类型,并返回适当的Java值。JDBC规范有一个表,显示允许的从SQL类型到ResultSet获取方法所使用的Java类型的映射关系。

注意:JDBC驱动程序目前不支持SQLServersqlvariant数据类型。如果使用查询从包含sqlvariant数据类型列的表中检索数据,则会发生异常。

基于SQLServer2005的数据类型,以下图表包含SQLServerResultSet类的get方法的JDBC驱动程序转换图,以及SQLServerCallableStatement类的get方法支持的转换。

JDBC驱动程序的getter方法支持三种基本的转换类别:

最近研究了一下opencms的locale,总结如下:(1)opencms在启动的时候会设置locale为en。(2)可以在folder上面设置locale,如果本级locale没有设置使用父级的,如果还是为空使用en。

本年度的学习主要围绕当前的工作主题和自己比较有兴趣的内容制定此计划。

2008-2月

(1)opencms

进一步熟悉jsp170规范,比较opencms7比当前我们使用的opencms6.2.3的改进。熟悉opencmsusermanager,权限,模块开发,sitedevelopment。

(2)整理,编写opencms的开发文档

2008-3月

(1)sso,分析当前sso的现状。了解使用sso带来的好处。配置和使用cas做练习。

(2)weblogicssl配置。

(3)openssl的使用。

2008-4月

(1)jetspeed学习jsr268规范,了解和jsr168的区别和改动。进一步分析jetspeed的sso实现。porelet定制实现。

(2)研究mvnforum的配置和使用。

(3)企业门户研究,研究企业门户应该满足那些功能,怎么更好的实现。

2008-5月

(1)webservice,分析和学习apache的webservice实现。

(2)etom模型的sid规范。

2008-6月

(1)osgi,学习osgi的规范,在设计中应该怎么使用osgi思想。

2008-7月

(1)jpa的使用和实现。

通常,在一个设计良好的Web应用中,都会综合使用Servlet和JSP技术。Servlet控制业务流转,JSP则负责业务处理结果的显示。此时,将大量用到重定向技术。

重定向技术可以分为两类,一类是客户端重定向,一类是服务器端重定向。客户端重定向可以通过设置特定的HTTP头,或者写JavaScript脚本实现。本文主要探讨服务器端重定向技术的实现。

HttpServletResponse.sendRedirect()方法

HttpServletResponse接口定义了可用于转向的sendRedirect()方法。代码如下:

publicvoidsendRedirect(java.lang.Stringlocation)throwsjava.io.IOException

RequestDispatcher.forward()方法

RequestDispatcher是一个Web资源的包装器,可以用来把当前request传递到该资源,或者把新的资源包括到当前响应中。RequestDispatcher接口中定义了两个方法,参见如下代码:

publicinterfaceRequestDispatcher{voidforward(ServletRequestrequest,ServletResponseresponse);voidinclude(ServletRequestrequest,ServletResponseresponse);}

forward()方法将当前的request和response重定向到该RequestDispacher指定的资源。这在实际项目中大量使用,因为完成一个业务操作往往需要跨越多个步骤,每一步骤完成相应的处理后,转向到下一个步骤。比如,通常业务处理在Servlet中处理,处理的结果转向到一个JSP页面进行显示。这样看起来类似于Servlet链的功能,但是还有一些区别。一个RequestDispatcher对象可以把请求发送到任意一个服务器资源,而不仅仅是另外一个Servlet。include()方法将把RequestDispatcher资源的输出包含到当前输出中。

注意,只有在尚未向客户端输出响应时才可以调用forward()方法,如果页面缓存不为空,在重定向前将自动清除缓存。否则将抛出一个IllegalStateException异常。

如何得到RequestDispatcher

有三种方法可以得到RequestDispatcher对象。

3.使用javax.servlet.ServletContext的getNamedDispatcher(Stringname)得到名为name的一个Web资源,包括Servlet和JSP页面。这个资源的名字在Web应用部署描述文件web.xml中指定。

这三种方法的使用有细微的差别。比如,下面是一个应用的配置文件web.xml:

其中定义了两个Servlet,名字分别为FirstServlet和SecondServlet,对应的类分别为org.javaresearch.redirecttest.ServletOne和org.javaresearch.redirecttest.ServletTwo。可以在浏览器中通过类似于下面的链接访问:

使用1中方法,例如在firstservlet可以写入下面的代码:

RequestDispatcherrd=request.getRequestDispatcher("secondservlet");rd.forward(request,response);

此时控制权将转向到第二个Servlet了。

使用2中的方法,可以从ServletContext中得到RequestDispatcher代码如下:

RequestDispatcherrd=getServletContext().getRequestDispatcher("/servlet/secondservlet");rd.forward(request,response);

使用3中的方法,从上面的web.xml配置文件可以看到定义了两个Servlet,名字分别为FirstServlet和SecondServlet,所以可以得到命名的Dispatcher:

RequestDispatcherrd=getServletContext().getNamedDispatcher("SecondServlet");rd.forward(request,response);

这样也可以重定向到SecondServlet了。

JSP页面中的重定向

JSP在解析后编译为一个Servlet运行,所以在JSP中也可以使用上面的重定向代码,并且,JSP还提供了更便利的操作,如下:

JSP页面执行到这儿,将终止当前的处理,将控制权交由nextpage.jsp。

如何选择

RequestDispatcher.forward()方法和HttpServletResponse.sendRedirect()方法的区别是:前者仅是容器中控制权的转向,在客户端浏览器地址栏中不会显示出转向后的地址;后者则是完全的跳转,浏览器将会得到跳转的地址,并重新发送请求链接。这样,从浏览器的地址栏中可以看到跳转后的链接地址。所以,前者更加高效,在前者可以满足需要时,尽量使用RequestDispatcher.forward()方法,并且,这样也有助于隐藏实际的链接。在有些情况下,比如,需要跳转到一个其它服务器上的资源,则必须使用HttpServletResponse.sendRequest()方法

ApacheHTTPServer插件允许将请求从ApacheHTTPServer代理到WebLogicServer。该插件允许WebLogicServer处理要求使用WebLogicServer动态功能的请求,从而增强了Apache安装。

HTTP隧道是一种技术,它允许HTTP请求和响应通过公司的防火墙进行访问。它也可以通过插件操作,提供对WebLogicServer服务的非浏览器客户端访问。

ApacheHTTPServer插件充当ApacheHTTPServer中的Apache模块。Apache模块由ApacheServer在启动时加载,然后某些HTTP请求会委托给它。Apache模块类似于HTTPServlet(除了Apache模块是用平台本地代码编写的之外)。

可将ApacheHTTPServer插件作为ApacheHTTPServer安装中的Apache模块进行安装,并将其作为动态共享对象(DynamicSharedObject,简称DSO)进行链接。

DSO作为服务器在运行时动态加载的库进行编译,可以在不重新编译Apache的情况下安装。

Apache插件作为Solaris、Linux、Windows和HPUX11平台的共享对象(.so)分发。BEAWebLogic提供因平台、是否要在客户端和Apache之间使用SSL以及SSL加密强度(常规或128位-只有在安装128位版本的WebLogicServer时才会安装128位版本)而异的共享对象文件版本。

exportEXTRA_LDFLAGS="-lstd-lstream-lCsup-lm-lcl-ldld-lpthread"

从下表中选择适当的插件共享对象版本:

要将ApacheHTTPServer插件作为动态共享对象安装,请执行下列操作:

本部分描述如何创建weblogic.conf文件,并包括示例weblogic.conf文件。

构造weblogic.conf文件时,请注意下列事项:

以下示例weblogic.conf文件可以用作模板,您可以对其进行修改以满足您的环境和服务器的需要。以#开始的行是注释。

请注意,ApacheHTTPServer不区分大小写。

使用边界身份验证可确保通过Apache插件访问的WebLogicServer应用程序的安全。

可以使用安全套接口层(SecureSocketLayer,简称SSL)协议保护ApacheHTTPServer插件和WebLogicServer之间的连接。SSL协议对ApacheHTTPServer插件和WebLogicServer之间传递的数据提供机密性和完整性。

虽然可以在HTTP客户端和ApacheHTTPServer之间使用双向SSL,但请注意,在ApacheHTTPServer和WebLogicServer之间使用的是单向SSL。

要在ApacheHTTPServer插件和WebLogicServer之间使用SSL协议,请执行下列操作:

配置Apache插件以使用SSL时会出现以下已知问题:

WebLogicServer主机无法响应连接请求可能表明下列问题:

所有WebLogicServer实例都无法响应可能表明下列问题:

在有负载时,Apache插件可能收到来自后端WebLogicServer实例的CONNECTION_REFUSED错误。可根据以下调整提示减少CONNECTION_REFUSED错误:

如果仅运行一个WebLogicServer实例,则插件仅尝试连接到使用WebLogicHost参数定义的服务器。如果尝试失败,则会返回HTTP503错误消息。插件继续尝试连接到该同一WebLogicServer实例,直到超出ConnectTimeoutSecs。

在上图中,红圈中允许的最大重试次数等于ConnectTimeoutSecs除以ConnectRetrySecs。

可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串Ip值,究竟哪个才是真正的用户端的真实IP呢?答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110,192.168.1.120,192.168.1.130,192.168.1.100用户真实IP为:192.168.1.110

Inthefigureabove,thefirstbar,labeled"html",istheinitialrequestfortheHTMLdocument.Inthiscase,only5%oftheend-userresponsetimeisspentfetchingtheHTMLdocument.Thisresultholdstrueforalmostallwebsites.InsamplingthetoptenU.S.websites,allbutonespendlessthan20%ofthetotalresponsetimegettingtheHTMLdocument.Theother80+%ofthetimeisspentdealingwithwhat'sintheHTMLdocument,namely,thefront-end.That'swhythekeytofasterwebsitesistofocusonimprovingfront-endperformance.

Therearethreemainreasonswhyfront-endperformanceistheplacetostart.Ourperformancegoldenruleis:optimizefront-endperformancefirst,that'swhere80%ormoreoftheend-userresponsetimeisspent.

80%oftheend-userresponsetimeisspentonthefront-end.Mostofthistimeistiedupindownloadingallthecomponentsinthepage:images,stylesheets,scripts,Flash,etc.ReducingthenumberofcomponentsinturnreducesthenumberofHTTPrequestsrequiredtorenderthepage.Thisisthekeytofasterpages.

Onewaytoreducethenumberofcomponentsinthepageistosimplifythepage'sdesign.ButisthereawaytobuildpageswithrichercontentwhilealsoachievingfastresponsetimesHerearesometechniquesforreducingthenumberofHTTPrequests,whilestillsupportingrichpagedesigns.

CombinedfilesareawaytoreducethenumberofHTTPrequestsbycombiningallscriptsintoasinglescript,andsimilarlycombiningallstylesheetsintoasinglestylesheet.It'sasimpleideathathasn'tseenwideadoption.ThetentopU.S.websitesaverage7scriptsand2stylesheetsperpage.Combiningfilesismorechallengingwhenthescriptsandstylesheetsvaryfrompagetopage,butmakingthispartofyourreleaseprocessimprovesresponsetimes.

Theuser'sproximitytoyourwebserverhasanimpactonresponsetimes.Deployingyourcontentacrossmultiple,geographicallydispersedserverswillmakeyourpagesloadfasterfromtheuser'sperspective.Butwhereshouldyoustart

Asafirststeptoimplementinggeographicallydispersedcontent,don'tattempttoredesignyourwebapplicationtoworkinadistributedarchitecture.Dependingontheapplication,changingthearchitecturecouldincludedauntingtaskssuchassynchronizingsessionstateandreplicatingdatabasetransactionsacrossserverlocations.Attemptstoreducethedistancebetweenusersandyourcontentcouldbedelayedby,orneverpass,thisapplicationarchitecturestep.

Acontentdeliverynetwork(CDN)isacollectionofwebserversdistributedacrossmultiplelocationstodelivercontentmoreefficientlytousers.Theserverselectedfordeliveringcontenttoaspecificuseristypicallybasedonameasureofnetworkproximity.Forexample,theserverwiththefewestnetworkhopsortheserverwiththequickestresponsetimeischosen.

Webpagedesignsaregettingricherandricher,whichmeansmorescripts,stylesheets,images,andFlashinthepage.Afirst-timevisitortoyourpagemayhavetomakeseveralHTTPrequests,butbyusingtheExpiresheaderyoumakethosecomponentscacheable.ThisavoidsunnecessaryHTTPrequestsonsubsequentpageviews.Expiresheadersaremostoftenusedwithimages,buttheyshouldbeusedonallcomponentsincludingscripts,stylesheets,andFlashcomponents.

Browsers(andproxies)useacachetoreducethenumberandsizeofHTTPrequests,makingwebpagesloadfaster.AwebserverusestheExpiresheaderintheHTTPresponsetotelltheclienthowlongacomponentcanbecached.ThisisafarfutureExpiresheader,tellingthebrowserthatthisresponsewon'tbestaleuntilApril15,2010.

IfyourserverisApache,usetheExiresDefaultdirectivetosetanexpirationdaterelativetothecurrentdate.ThisexampleoftheExpiresDefaultdirectivesetstheExpiresdate10yearsoutfromthetimeoftherequest.

Keepinmind,ifyouuseafarfutureExpiresheaderyouhavetochangethecomponent'sfilenamewheneverthecomponentchanges.AtYahoo!weoftenmakethissteppartofthebuildprocess:aversionnumberisembeddedinthecomponent'sfilename,forexample,yahoo_2.0.6.js.

ThetimeittakestotransferanHTTPrequestandresponseacrossthenetworkcanbesignificantlyreducedbydecisionsmadebyfront-endengineers.It'struethattheend-user'sbandwidthspeed,Internetserviceprovider,proximitytopeeringexchangepoints,etc.arebeyondthecontrolofthedevelopmentteam.Butthereareothervariablesthataffectresponsetimes.CompressionreducesresponsetimesbyreducingthesizeoftheHTTPresponse.

StartingwithHTTP/1.1,webclientsindicatesupportforcompressionwiththeAccept-EncodingheaderintheHTTPrequest.

Accept-Encoding:gzip,deflateIfthewebserverseesthisheaderintherequest,itmaycompresstheresponseusingoneofthemethodslistedbytheclient.ThewebservernotifiesthewebclientofthisviatheContent-Encodingheaderintheresponse.

Thereareknownissueswithbrowsersandproxiesthatmaycauseamismatchinwhatthebrowserexpectsandwhatitreceiveswithregardtocompressedcontent.Fortunately,theseedgecasesaredwindlingastheuseofolderbrowsersdropsoff.TheApachemoduleshelpoutbyaddingappropriateVaryresponseheadersautomatically.

Serverschoosewhattogzipbasedonfiletype,butaretypicallytoolimitedinwhattheydecidetocompress.MostwebsitesgziptheirHTMLdocuments.It'salsoworthwhiletogzipyourscriptsandstylesheets,butmanywebsitesmissthisopportunity.Infact,it'sworthwhiletocompressanytextresponseincludingXMLandJSON.ImageandPDFfilesshouldnotbegzippedbecausetheyarealreadycompressed.TryingtogzipthemnotonlywastesCPUbutcanpotentiallyincreasefilesizes.

Gzippingasmanyfiletypesaspossibleisaneasywaytoreducepageweightandacceleratetheuserexperience.

WhileresearchingperformanceatYahoo!,wediscoveredthatmovingstylesheetstothedocumentHEADmakespagesloadfaster.ThisisbecauseputtingstylesheetsintheHEADallowsthepagetorenderprogressively.

Rule5describedhowstylesheetsnearthebottomofthepageprohibitprogressiverendering,andhowmovingthemtothedocumentHEADeliminatestheproblem.Scripts(externalJavaScriptfiles)poseasimilarproblem,butthesolutionisjusttheopposite:it'sbettertomovescriptsfromthetoptoaslowinthepageaspossible.Onereasonistoenableprogressiverendering,butanotheristoachievegreaterdownloadparallelization.

Withstylesheets,progressiverenderingisblockeduntilallstylesheetshavebeendownloaded.That'swhyit'sbesttomovestylesheetstothedocumentHEAD,sotheygetdownloadedfirstandrenderingisn'tblocked.Withscripts,progressiverenderingisblockedforallcontentbelowthescript.Movingscriptsaslowinthepageaspossiblemeansthere'smorecontentabovethescriptthatisrenderedsooner.

Insomesituationsit'snoteasytomovescriptstothebottom.If,forexample,thescriptusesdocument.writetoinsertpartofthepage'scontent,itcan'tbemovedlowerinthepage.Theremightalsobescopingissues.Inmanycases,therearewaystoworkaroundthesesituations.

Analternativesuggestionthatoftencomesupistousedeferredscripts.TheDEFERattributeindicatesthatthescriptdoesnotcontaindocument.write,andisacluetobrowsersthattheycancontinuerendering.Unfortunately,Firefoxdoesn'tsupporttheDEFERattribute.InInternetExplorer,thescriptmaybedeferred,butnotasmuchasdesired.Ifascriptcanbedeferred,itcanalsobemovedtothebottomofthepage.Thatwillmakeyourwebpagesloadfaster.

Asshownhere,theexpressionmethodacceptsaJavaScriptexpression.TheCSSpropertyissettotheresultofevaluatingtheJavaScriptexpression.Theexpressionmethodisignoredbyotherbrowsers,soitisusefulforsettingpropertiesinInternetExplorerneededtocreateaconsistentexperienceacrossbrowsers.

Theproblemwithexpressionsisthattheyareevaluatedmorefrequentlythanmostpeopleexpect.Notonlyaretheyevaluatedwhenthepageisrenderedandresized,butalsowhenthepageisscrolledandevenwhentheusermovesthemouseoverthepage.AddingacountertotheCSSexpressionallowsustokeeptrackofwhenandhowoftenaCSSexpressionisevaluated.Movingthemousearoundthepagecaneasilygeneratemorethan10,000evaluations.

OnewaytoreducethenumberoftimesyourCSSexpressionisevaluatedistouseone-timeexpressions,wherethefirsttimetheexpressionisevaluateditsetsthestylepropertytoanexplicitvalue,whichreplacestheCSSexpression.Ifthestylepropertymustbesetdynamicallythroughoutthelifeofthepage,usingeventhandlersinsteadofCSSexpressionsisanalternativeapproach.IfyoumustuseCSSexpressions,rememberthattheymaybeevaluatedthousandsoftimesandcouldaffecttheperformanceofyourpage.

Manyoftheseperformancerulesdealwithhowexternalcomponentsaremanaged.However,beforetheseconsiderationsariseyoushouldaskamorebasicquestion:ShouldJavaScriptandCSSbecontainedinexternalfiles,orinlinedinthepageitself

UsingexternalfilesintherealworldgenerallyproducesfasterpagesbecausetheJavaScriptandCSSfilesarecachedbythebrowser.JavaScriptandCSSthatareinlinedinHTMLdocumentsgetdownloadedeverytimetheHTMLdocumentisrequested.ThisreducesthenumberofHTTPrequeststhatareneeded,butincreasesthesizeoftheHTMLdocument.Ontheotherhand,iftheJavaScriptandCSSareinexternalfilescachedbythebrowser,thesizeoftheHTMLdocumentisreducedwithoutincreasingthenumberofHTTPrequests.

Thekeyfactor,then,isthefrequencywithwhichexternalJavaScriptandCSScomponentsarecachedrelativetothenumberofHTMLdocumentsrequested.Thisfactor,althoughdifficulttoquantify,canbegaugedusingvariousmetrics.Ifusersonyoursitehavemultiplepageviewspersessionandmanyofyourpagesre-usethesamescriptsandstylesheets,thereisagreaterpotentialbenefitfromcachedexternalfiles.

Forfrontpagesthataretypicallythefirstofmanypageviews,therearetechniquesthatleveragethereductionofHTTPrequeststhatinliningprovides,aswellasthecachingbenefitsachievedthroughusingexternalfiles.OnesuchtechniqueistoinlineJavaScriptandCSSinthefrontpage,butdynamicallydownloadtheexternalfilesafterthepagehasfinishedloading.Subsequentpageswouldreferencetheexternalfilesthatshouldalreadybeinthebrowser'scache.

TheDomainNameSystem(DNS)mapshostnamestoIPaddresses,justasphonebooksmappeople'snamestotheirphonenumbers.Whenyoutypewww.yahoo.comintoyourbrowser,aDNSresolvercontactedbythebrowserreturnsthatserver'sIPaddress.DNShasacost.Ittypicallytakes20-120millisecondsforDNStolookuptheIPaddressforagivenhostname.Thebrowsercan'tdownloadanythingfromthishostnameuntiltheDNSlookupiscompleted.

DNSlookupsarecachedforbetterperformance.Thiscachingcanoccuronaspecialcachingserver,maintainedbytheuser'sISPorlocalareanetwork,butthereisalsocachingthatoccursontheindividualuser'scomputer.TheDNSinformationremainsintheoperatingsystem'sDNScache(the"DNSClientservice"onMicrosoftWindows).Mostbrowsershavetheirowncaches,separatefromtheoperatingsystem'scache.AslongasthebrowserkeepsaDNSrecordinitsowncache,itdoesn'tbothertheoperatingsystemwitharequestfortherecord.

InternetExplorercachesDNSlookupsfor30minutesbydefault,asspecifiedbytheDnsCacheTimeoutregistrysetting.FirefoxcachesDNSlookupsfor1minute,controlledbythenetwork.dnsCacheExpirationconfigurationsetting.(Fasterfoxchangesthisto1hour.)

Whentheclient'sDNScacheisempty(forboththebrowserandtheoperatingsystem),thenumberofDNSlookupsisequaltothenumberofuniquehostnamesinthewebpage.Thisincludesthehostnamesusedinthepage'sURL,images,scriptfiles,stylesheets,Flashobjects,etc.ReducingthenumberofuniquehostnamesreducesthenumberofDNSlookups.

Reducingthenumberofuniquehostnameshasthepotentialtoreducetheamountofparalleldownloadingthattakesplaceinthepage.AvoidingDNSlookupscutsresponsetimes,butreducingparalleldownloadsmayincreaseresponsetimes.Myguidelineistosplitthesecomponentsacrossatleasttwobutnomorethanfourhostnames.ThisresultsinagoodcompromisebetweenreducingDNSlookupsandallowingahighdegreeofparalleldownloads.

Minificationisasafe,fairlystraightforwardprocess.Obfuscation,ontheotherhand,ismorecomplexandthusmorelikelytogeneratebugsasaresultoftheobfuscationstepitself.ObfuscationalsorequiresmodifyingyourcodetoindicateAPIfunctionsandothersymbolsthatshouldnotbemunged.Italsomakesithardertodebugyourcodeinproduction.AlthoughI'veneverseenproblemsintroducedfromminification,Ihaveseenbugscausedbyobfuscation.InasurveyoftentopU.S.websites,minificationachieveda21%sizereductionversus25%forobfuscation.Althoughobfuscationhasahighersizereduction,IrecommendminifyingJavaScriptcodebecauseofthereducedrisksandmaintenancecosts.

Redirectsareaccomplishedusingthe301and302statuscodes.Here'sanexampleoftheHTTPheadersina301response:

ThebrowserautomaticallytakestheusertotheURLspecifiedintheLocationfield.Alltheinformationnecessaryforaredirectisintheheaders.Thebodyoftheresponseistypicallyempty.Despitetheirnames,neithera301nora302responseiscachedinpracticeunlessadditionalheaders,suchasExpiresorCache-Control,indicateitshouldbe.ThemetarefreshtagandJavaScriptareotherwaystodirectuserstoadifferentURL,butifyoumustdoaredirect,thepreferredtechniqueistousethestandard3xxHTTPstatuscodes,primarilytoensurethebackbuttonworkscorrectly.

Themainthingtorememberisthatredirectsslowdowntheuserexperience.InsertingaredirectbetweentheuserandtheHTMLdocumentdelayseverythinginthepagesincenothinginthepagecanberenderedandnocomponentscanstartbeingdownloadeduntiltheHTMLdocumenthasarrived.

Connectinganoldwebsitetoanewoneisanothercommonuseforredirects.Othersincludeconnectingdifferentpartsofawebsiteanddirectingtheuserbasedoncertainconditions(typeofbrowser,typeofuseraccount,etc.).Usingaredirecttoconnecttwowebsitesissimpleandrequireslittleadditionalcoding.Althoughusingredirectsinthesesituationsreducesthecomplexityfordevelopers,itdegradestheuserexperience.AlternativesforthisuseofredirectsincludeusingAliasandmod_rewriteifthetwocodepathsarehostedonthesameserver.Ifadomainnamechangeisthecauseofusingredirects,analternativeistocreateaCNAME(aDNSrecordthatcreatesanaliaspointingfromonedomainnametoanother)incombinationwithAliasormod_rewrite.

IthurtsperformancetoincludethesameJavaScriptfiletwiceinonepage.Thisisn'tasunusualasyoumightthink.AreviewofthetentopU.S.websitesshowsthattwoofthemcontainaduplicatedscript.Twomainfactorsincreasetheoddsofascriptbeingduplicatedinasinglewebpage:teamsizeandnumberofscripts.Whenitdoeshappen,duplicatescriptshurtperformancebycreatingunnecessaryHTTPrequestsandwastedJavaScriptexecution.

UnnecessaryHTTPrequestshappeninInternetExplorer,butnotinFirefox.InInternetExplorer,ifanexternalscriptisincludedtwiceandisnotcacheable,itgeneratestwoHTTPrequestsduringpageloading.Evenifthescriptiscacheable,extraHTTPrequestsoccurwhentheuserreloadsthepage.

InadditiontogeneratingwastefulHTTPrequests,timeiswastedevaluatingthescriptmultipletimes.ThisredundantJavaScriptexecutionhappensinbothFirefoxandInternetExplorer,regardlessofwhetherthescriptiscacheable.

Onewaytoavoidaccidentallyincludingthesamescripttwiceistoimplementascriptmanagementmoduleinyourtemplatingsystem.ThetypicalwaytoincludeascriptistousetheSCRIPTtaginyourHTMLpage.

Entitytags(ETags)areamechanismthatwebserversandbrowsersusetodeterminewhetherthecomponentinthebrowser'scachematchestheoneontheoriginserver.(An"entity"isanotherwordforwhatI'vebeencallinga"component":images,scripts,stylesheets,etc.)ETagswereaddedtoprovideamechanismforvalidatingentitiesthatismoreflexiblethanthelast-modifieddate.AnETagisastringthatuniquelyidentifiesaspecificversionofacomponent.Theonlyformatconstraintsarethatthestringbequoted.Theoriginserverspecifiesthecomponent'sETagusingtheETagresponseheader.

Later,ifthebrowserhastovalidateacomponent,itusestheIf-None-MatchheadertopasstheETagbacktotheoriginserver.IftheETagsmatch,a304statuscodeisreturnedreducingtheresponseby12195bytesforthisexample.GET/i/yahoo.gifHTTP/1.1Host:us.yimg.comIf-Modified-Since:Tue,12Dec200603:03:59GMTIf-None-Match:"10c24bc-4ab-457e1c1f"HTTP/1.1304NotModified

PeopleaskwhethertheseperformancerulesapplytoWeb2.0applications.Theydefinitelydo!ThisruleisthefirstrulethatresultedfromworkingwithWeb2.0applicationsatYahoo!.

OneofthecitedbenefitsofAjaxisthatitprovidesinstantaneousfeedbacktotheuserbecauseitrequestsinformationasynchronouslyfromthebackendwebserver.However,usingAjaxisnoguaranteethattheuserwon'tbetwiddlinghisthumbswaitingforthoseasynchronousJavaScriptandXMLresponsestoreturn.Inmanyapplications,whetherornottheuseriskeptwaitingdependsonhowAjaxisused.Forexample,inaweb-basedemailclienttheuserwillbekeptwaitingfortheresultsofanAjaxrequesttofindalltheemailmessagesthatmatchtheirsearchcriteria.It'simportanttorememberthat"asynchronous"doesnotimply"instantaneous".

However,Rule3isthemostimportantforspeedinguptheuserexperience.Let'slookatanexample.AWeb2.0emailclientmightuseAjaxtodownloadtheuser'saddressbookforautocompletion.Iftheuserhasn'tmodifiedheraddressbooksincethelasttimesheusedtheemailwebapp,thepreviousaddressbookresponsecouldbereadfromcacheifthatAjaxresponsewasmadecacheablewithafutureExpiresheader.Thebrowsermustbeinformedwhentouseapreviouslycachedaddressbookresponseversusrequestinganewone.ThiscouldbedonebyaddingatimestamptotheaddressbookAjaxURLindicatingthelasttimetheusermodifiedheraddressbook,forexample,&t=1190241612.Iftheaddressbookhasn'tbeenmodifiedsincethelastdownload,thetimestampwillbethesameandtheaddressbookwillbereadfromthebrowser'scacheeliminatinganextraHTTProundtrip.Iftheuserhasmodifiedheraddressbook,thetimestampensuresthenewURLdoesn'tmatchthecachedresponse,andthebrowserwillrequesttheupdatedaddressbookentries.

EventhoughyourAjaxresponsesarecreateddynamically,andmightonlybeapplicabletoasingleuser,theycanstillbecached.DoingsowillmakeyourWeb2.0appsfaster.

Apache2.XX中prefork.c模块和worker.c模块的比较

空闲子进程:是指没有正在处理请求的子进程。

ServerLimit20000StartServers5MinSpareServers5MaxSpareServers10MaxClients1000MaxRequestsPerChild0

ServerLimit2000//默认的MaxClient最大是256个线程,如果想设置更大的值,就的加上ServerLimit这个参数。20000是ServerLimit这个参数的最大值。如果需要更大,则必须编译apache,此前都是不需要重新编译Apache。生效前提:必须放在其他指令的前面

StartServers5//指定服务器启动时建立的子进程数量,prefork默认为5。

MinSpareServers5//指定空闲子进程的最小数量,默认为5。如果当前空闲子进程数少于MinSpareServers,那么Apache将以最大每秒一个的速度产生新的子进程。此参数不要设的太大。

MaxSpareServers10//设置空闲子进程的最大数量,默认为10。如果当前有超过MaxSpareServers数量的空闲子进程,那么父进程将杀死多余的子进程。此参数不要设的太大。如果你将该指令的值设置为比MinSpareServers小,Apache将会自动将其修改成"MinSpareServers+1"。

MaxRequestsPerChild10000//每个子进程在其生存期内允许伺服的最大请求数量,默认为10000.到达MaxRequestsPerChild的限制后,子进程将会结束。如果MaxRequestsPerChild为"0",子进程将永远不会结束。

将MaxRequestsPerChild设置成非零值有两个好处:1.可以防止(偶然的)内存泄漏无限进行,从而耗尽内存。2.给进程一个有限寿命,从而有助于当服务器负载减轻的时候减少活动进程的数量。

工作方式:一个单独的控制进程(父进程)负责产生子进程,这些子进程用于监听请求并作出应答。Apache总是试图保持一些备用的(spare)或者是空闲的子进程用于迎接即将到来的请求。这样客户端就不需要在得到服务前等候子进程的产生。在Unix系统中,父进程通常以root身份运行以便邦定80端口,而Apache产生的子进程通常以一个低特权的用户运行。User和Group指令用于设置子进程的低特权用户。运行子进程的用户必须要对它所服务的内容有读取的权限,但是对服务内容之外的其他资源必须拥有尽可能少的权限。

ServerLimit50ThreadLimit200StartServers5MaxClients5000MinSpareThreads25MaxSpareThreads500ThreadsPerChild100MaxRequestsPerChild0

ServerLimit16//服务器允许配置的进程数上限。这个指令和ThreadLimit结合使用设置了MaxClients最大允许配置的数值。任何在重启期间对这个指令的改变都将被忽略,但对MaxClients的修改却会生效。

ThreadLimit64//每个子进程可配置的线程数上限。这个指令设置了每个子进程可配置的线程数ThreadsPerChild上限。任何在重启期间对这个指令的改变都将被忽略,但对ThreadsPerChild的修改却会生效。默认值是"64".

StartServers3//服务器启动时建立的子进程数,默认值是"3"。

MinSpareThreads75//最小空闲线程数,默认值是"75"。这个MPM将基于整个服务器监视空闲线程数。如果服务器中总的空闲线程数太少,子进程将产生新的空闲线程。

MaxSpareThreads250//设置最大空闲线程数。默认值是"250"。这个MPM将基于整个服务器监视空闲线程数。如果服务器中总的空闲线程数太多,子进程将杀死多余的空闲线程。MaxSpareThreads的取值范围是有限制的。Apache将按照如下限制自动修正你设置的值:worker要求其大于等于MinSpareThreads加上ThreadsPerChild的和

MaxClients400//允许同时伺服的最大接入请求数量(最大线程数量)。任何超过MaxClients限制的请求都将进入等候队列。默认值是"400",16(ServerLimit)乘以25(ThreadsPerChild)的结果。因此要增加MaxClients的时候,你必须同时增加ServerLimit的值。

ThreadsPerChild25//每个子进程建立的常驻的执行线程数。默认值是25。子进程在启动时建立这些线程后就不再建立新的线程了。

MaxRequestsPerChild0//设置每个子进程在其生存期内允许伺服的最大请求数量。到达MaxRequestsPerChild的限制后,子进程将会结束。如果MaxRequestsPerChild为"0",子进程将永远不会结束。

将MaxRequestsPerChild设置成非零值有两个好处:1.可以防止(偶然的)内存泄漏无限进行,从而耗尽内存。2.给进程一个有限寿命,从而有助于当服务器负载减轻的时候减少活动进程的数量。注意对于KeepAlive链接,只有第一个请求会被计数。事实上,它改变了每个子进程限制最大链接数量的行为。

工作方式:每个进程可以拥有的线程数量是固定的。服务器会根据负载情况增加或减少进程数量。一个单独的控制进程(父进程)负责子进程的建立。每个子进程可以建立ThreadsPerChild数量的服务线程和一个监听线程,该监听线程监听接入请求并将其传递给服务线程处理和应答。Apache总是试图维持一个备用(spare)或是空闲的服务线程池。这样,客户端无须等待新线程或新进程的建立即可得到处理。在Unix中,为了能够绑定80端口,父进程一般都是以root身份启动,随后,Apache以较低权限的用户建立子进程和线程。User和Group指令用于设置Apache子进程的权限。虽然子进程必须对其提供的内容拥有读权限,但应该尽可能给予它较少的特权。另外,除非使用了suexec,否则,这些指令设置的权限将被CGI脚本所继承。

公式:ThreadLimit>=ThreadsPerChildMaxClients<=ServerLimit*ThreadsPerChild必须是ThreadsPerChild的倍数MaxSpareThreads>=MinSpareThreads+ThreadsPerChild

硬限制:

ServerLimi和ThreadLimit这两个指令决定了活动子进程数量和每个子进程中线程数量的硬限制。要想改变这个硬限制必须完全停止服务器然后再启动服务器(直接重启是不行的)。

Apache在编译ServerLimit时内部有一个硬性的限制,你不能超越这个限制。preforkMPM最大为"ServerLimit200000"其它MPM(包括workMPM)最大为"ServerLimit20000

Apache在编译ThreadLimit时内部有一个硬性的限制,你不能超越这个限制。mpm_winnt是"ThreadLimit15000"其它MPM(包括workprefork)为"ThreadLimit20000

注意使用ServerLimit和ThreadLimit时要特别当心。如果将ServerLimit和ThreadLimit设置成一个高出实际需要许多的值,将会有过多的共享内存被分配。当设置成超过系统的处理能力,Apache可能无法启动,或者系统将变得不稳定。

THE END
1.在线课程的特点依托现代信息技术,随着网站设计、网络课程等的出现,网络课程具有不同于传统课程的功能和特点。总之,在线课程可以适应基础教育课程改革的趋势和要求。具体来说,它表现出以下主要特点。 I、课程覆盖的民主化 让不同地区、不同国家、无论贫富的青少年都能享受到最理想的教育,义务教育成为受教育的权利,教育民主化在互联网https://www.xjcj-edu.com/web/12457.html
2.在线初学英语,探索与突破之路财务局在线初学英语是一种便捷的学习方式,通过在线平台学习英语,可以随时随地学习,不受时间和地点的限制。在学习过程中,需要不断探索新的学习方法和技巧,突破传统学习方式的束缚。通过在线学习,可以充分利用网络资源丰富自己的学习体验,提高学习效率。在线初学英语也需要学习者具备自主学习和自我驱动的能力,才能更好地掌握英语语http://5g.hnjwwzy.cn/post/330.html
3.我认为上网课有好处也有坏处用英语怎么说英语翻译我认为上网课有好处也有坏处用英语怎么说,我认为上网课有好处也有坏处英语翻译I think online classes have both advantages and disadvantages,英语翻译详细结果;关于我认为上网课有好处也有坏处的重要英语词汇 短语 记忆技巧.https://yingyu.xiediantong.com/en/30cf6473c5611674/
4.网络的利与弊英语作文(通用34篇)随着社会的进步,科技的发展,各种眼花缭乱的电子产品被送进了商场,其中,电脑是最普遍的.,几乎家家户户都有电脑,那么,电脑有什么好处和坏处呢? 网络的好处非常之多,比如说:“我们可以查资料、可以看新闻、可以听音乐、可以上qq视频聊天、可以休闲时玩会儿游戏、可以用360安全浏览器来防止进入木马病毒……”真是既https://m.ruiwen.com/zuowen/wangluo/2602894.html
5.Julia数据科学应用本书介绍了Julia在数据科学领域的应用以及相关的几个基本的数据科学原理,然后,详细介绍了如何安装Julia并发挥其功能强大的库。本书提供了众多的示例,展示了使用Julia命令、数据集和函数所能够解决的问题。本书每一章都带有练习和问题,帮助读者掌握Julia这一数据分析工具。 https://labs.epubit.com/bookDetails?id=N1486
6.net的Web Page is Unavailable We are very sorry.http://ado.net/
7.python面试整理请按alist中元素的age由大到小排序,写出相应的代码1.有一个jsonline格式的文件file.txt大小约为10K defget_lines():withopen('file.txt','rb')asf:returnf.readlines()if__name__=='__main__':foreinget_lines():process(e)# 处理每一行数据defget_lines():withopen('file.txt','rb')asf:foriinf:yieldi https://blog.csdn.net/qq_40230938/article/details/108714493
8.2022年6月大学英语四级考试真题答案详细解析而不是为了满足学生的需求故排除D)e.【定位】由题干中的onedisadvantageofonlineclasses定位到第五段第一句D)【精析】细节辨认题定位句提到也许参与在线课程的最大缺点是教师和学生之间缺乏面对面的互动第六段进一步指出,学生之间的互动也很少,学生很难创建学习小组并与同龄人建立关系故正确答案为D)【避错】第五段https://www.yxfsz.com/view/1657597369078878209
9.高考真题旅行当职业:十种方法边旅行边赚钱如果你有能力教瑜伽、普拉提、太极拳或其他健身项目,那你在任何地方都可以尝试做健身指导员。你既可以在家开一间培训室,也可以在附近沙滩上课。(尤其是在有名气的景点,那里到处都是期待影片《美食祈祷和恋爱》经历的游客。)自己开培训班的好处是,你可以自主安排时间,不必受合同约束,只要愿意,随时都能出去游玩! http://m.hujiang.com/en_hjgaokaozhenti/p543073/
10.自考英语二历年真题及答案(2005学历提升学历教育从下列各句四个选项中选出一个最佳答案,并在答题卡上将相应的字母涂黑。 ’t you rather your child ___ successful with his study and won the scholarship? A. became B. become C. would become D. becomes 2. Although Tom is satisfied with his academic achievement, he wonders ___will happen http://xueli.en369.cn/xuexiao/1699684445278221.html
11.CreatingModelClasseswithLINQtoSQL接下来,我们将学习如何使用 Repository 模式。使用 Repository 模式需要更多的工作。然而,采用这种模式的好处是构建的应用程序更适合更改且易于进行测试。 什么是 Model 类? MVC 模型包含未包含在 MVC 视图或 MVC 控制器中的所有应用程序逻辑。其特别之处在于,MVC 模型包含所有应用程序业务和数据访问逻辑。 https://msdn.microsoft.com/zh-cn/dd408820
12.英语广东省深圳市2023Computersarewidelyusedintheworld.Asstudents,wecannotonlyusethem36(relax),butalsostudyonline.Becauseofthevirusnow,we37(have)onlinelessonsathome.Allyouneedisacomputerandanearphone.However,moststudentsdon’tseemtolikeonlineclasses.Severaldaysago,over2,000studentsfrom10cities38(take)partinasurvey.Accordingtothesurvhttps://m.book118.com/html/2024/0109/6042051142010032.shtm