<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>枫蓝部落格</title>
	<atom:link href="http://www.atongmu.cn/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.atongmu.cn</link>
	<description>Maple Blue Blog</description>
	<pubDate>Sat, 04 Sep 2010 10:37:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JVM优化</title>
		<link>http://www.atongmu.cn/?p=6386</link>
		<comments>http://www.atongmu.cn/?p=6386#comments</comments>
		<pubDate>Sat, 04 Sep 2010 10:37:04 +0000</pubDate>
		<dc:creator>噪音有害健康</dc:creator>
		
		<category><![CDATA[技术片段]]></category>

		<guid isPermaLink="false">http://www.atongmu.cn/?p=6386</guid>
		<description><![CDATA[


一.JVM内存的设置的原理
默认的java虚拟机的大小比较小，在对大数据进行处理时java就会报错：java.lang.OutOfMemoryError。设置jvm内存的方法，对于单独的.class，可以用下面的方法对Test运行时的jvm内存进行设置。 java -Xms64m -Xmx256m Test -Xms是设置内存初始化的大小 -Xmx是设置最大能够使用内存的大小（最好不要超过物理内存大小） 在weblogic中，可以在startweblogic.cmd中对每个domain虚拟内存的大小进行设置，默认的设置是在commEnv.cmd里面。

-vmargs  -Xms128M -Xmx512M  -XX:PermSize=64M  -XX:MaxPermSize=128M
下面是这几个设置的一些背景知识：

堆(Heap)和非堆(Non-heap)内存 按照官方的说法：“Java 虚拟机具有一个堆，堆是运行时数据区域，所有类实例和数组的内存均从此处分配。堆是在 Java  虚拟机启动时创建的。”“在JVM中堆之外的内存称为非堆内存(Non-heap  memory)”。可以看出JVM主要管理两种类型的内存：堆和非堆。简单来说堆就是Java代码可及的内存，是留给开发人员使用的；非堆就是JVM留给   自己用的，所以方法区、JVM内部处理或优化所需的内存(如JIT编译后的代码缓存)、每个类结构(如运行时常数池、字段和方法数据)以及方法和构造方法  的代码都在非堆内存中。
堆内存分配 JVM初始分配的内存由-Xms指定，默认是物理内存的1/64；JVM最  大分配的内存由-Xmx指定，默认是物理内存的1/4。默认空余堆内存小于40%时，JVM就会增大堆直到-Xmx的最大限制；空余堆内存大于70%时，  JVM会减少堆直到-Xms的最小限制。因此服务器一般设置-Xms、-Xmx相等以避免在每次GC 后调整堆的大小。
非堆内存分配 JVM使用-XX:PermSize设置非堆内存初始值，默认是物理内存的1/64；由XX:MaxPermSize设置最大非堆内存的大小，默认是物理内存的1/4。
JVM内存限制(最大值) 首先JVM内存首先受限于实际的最大物理内存，假设物理内存无限  大的话，JVM内存的最大值跟操作系统有很大的关系。简单的说就32位处理器虽然可控内存空间有4GB,但是具体的操作系统会给一个限制，这个限制一般是  2GB-3GB（一般来说Windows系统下为1.5G-2G，Linux系统下为2G-3G），而64bit以上的处理器就不会有限制了


JVM内存的调优
1. Heap设定与垃圾回收Java Heap分为3个区，Young，Old和Permanent。Young保存刚实例化的对象。当该区被填满时，GC会将对象移到Old区。Permanent区则负责保存反射对象，本文不讨论该区。JVM的Heap分配可以使用-X参数设定，




-Xms


初始Heap大小




-Xmx


java heap最大值




-Xmn


young generation的heap大小




JVM有2个GC线程。第一个线程负责回收Heap的Young区。第二个线程在Heap不足时，遍历Heap，将Young 区升级为Older区。Older区的大小等于-Xmx减去-Xmn，不能将-Xms的值设的过大，因为第二个线程被迫运行会降低JVM的性能。
为什么一些程序频繁发生GC？有如下原因：
l 程序内调用了System.gc()或Runtime.gc()。
l 一些中间件软件调用自己的GC方法，此时需要设置参数禁止这些GC。
l         Java的Heap太小，一般默认的Heap值都很小。
l 频繁实例化对象，Release对象。此时尽量保存并重用对象，例如使用StringBuffer()和String()。
 如果你发现每次GC后，Heap的剩余空间会是总空间的50%，这表示你的Heap处于健康状态。许多Server端的Java程序每次GC后最好能有65%的剩余空间。经验之谈：
1．Server端JVM最好将-Xms和-Xmx设为相同值。为了优化GC，最好让-Xmn值约等于-Xmx的1/3[2]。
2．一个GUI程序最好是每10到20秒间运行一次GC，每次在半秒之内完成[2]。
注意：
1．增加Heap的大小虽然会降低GC的频率，但也增加了每次GC的时间。并且GC运行时，所有的用户线程将暂停，也就是GC期间，Java应用程序不做任何工作。
2．Heap大小并不决定进程的内存使用量。进程的内存使用量要大于-Xmx定义的值，因为Java为其他任务分配内存，例如每个线程的Stack等。
2．Stack的设定
每个线程都有他自己的Stack。




-Xss


每个线程的Stack大小




Stack的大小限制着线程的数量。如果Stack过大就好导致内存溢漏。-Xss参数决定Stack大小，例如-Xss1024K。如果Stack太小，也会导致Stack溢漏。
3．硬件环境
硬件环境也影响GC的效率，例如机器的种类，内存，swap空间，和CPU的数量。
如果你的程序需要频繁创建很多transient对象，会导致JVM频繁GC。这种情况你可以增加机器的内存，来减少Swap空间的使用[2]。
4．4种GC
第一种为单线程GC，也是默认的GC。，该GC适用于单CPU机器。
第二种为Throughput GC，是多线程的GC，适用于多CPU，使用大量线程的程序。第二种GC与第一种GC相似，不同在于GC在收集Young区是多线程的，但在Old区和第一种一样，仍然采用单线程。-XX:+UseParallelGC参数启动该GC。
第三种为Concurrent Low Pause GC，类似于第一种，适用于多CPU，并要求缩短因GC造成程序停滞的时间。这种GC可以在Old区的回收同时，运行应用程序。-XX:+UseConcMarkSweepGC参数启动该GC。
第四种为Incremental Low Pause [...]]]></description>
			<content:encoded><![CDATA[<div class="g_blog_list">
<div class="g_t_center g_c_pdin g_p_center c07 content">
<div class="ns_content"><span style="font-size: 13px; color: #333333; line-height: 20px;"></p>
<p style="line-height: normal;"><strong style="line-height: normal;"><span style="line-height: normal;">一</span><span style="line-height: normal;">.JVM</span></strong><strong style="line-height: normal;"><span style="line-height: normal;">内存的设置的原理</span></strong></p>
<p style="line-height: normal;"><span style="line-height: normal;">默认的</span><span style="line-height: normal;">java</span><span style="line-height: normal;">虚拟机的大小比较小，在对大数据进行处理时</span><span style="line-height: normal;">java</span><span style="line-height: normal;">就会报错：</span><span style="line-height: normal;">java.lang.OutOfMemoryError</span><span style="line-height: normal;">。设置</span><span style="line-height: normal;">jvm</span><span style="line-height: normal;">内存的方法，对于单独的</span><span style="line-height: normal;">.class</span><span style="line-height: normal;">，可以用下面的方法对</span><span style="line-height: normal;">Test</span><span style="line-height: normal;">运行时的</span><span style="line-height: normal;">jvm</span><span style="line-height: normal;">内存进行设置。</span><span style="line-height: normal;"><br style="line-height: normal;" /> java -Xms64m -Xmx256m Test<br style="line-height: normal;" /> -Xms</span><span style="line-height: normal;">是设置内存初始化的大小</span><span style="line-height: normal;"><br style="line-height: normal;" /> -Xmx</span><span style="line-height: normal;">是设置最大能够使用内存的大小（最好不要超过物理内存大小）</span><span style="line-height: normal;"><br style="line-height: normal;" /> </span><span style="line-height: normal;">在</span><span style="line-height: normal;">weblogic</span><span style="line-height: normal;">中，可以在</span><span style="line-height: normal;">startweblogic.cmd</span><span style="line-height: normal;">中对每个</span><span style="line-height: normal;">domain</span><span style="line-height: normal;">虚拟内存的大小进行设置，默认的设置是在</span><span style="line-height: normal;">commEnv.cmd</span><span style="line-height: normal;">里面。</span></p>
<p><span style="line-height: normal;"></p>
<p style="line-height: normal;"><span style="line-height: normal; color: #0000ff;">-vmargs <br style="line-height: normal;" /> -Xms128M<br style="line-height: normal;" /> -Xmx512M <br style="line-height: normal;" /> -XX:PermSize=64M <br style="line-height: normal;" /> -XX:MaxPermSize=128M</span></p>
<p style="line-height: normal;"><span style="line-height: normal; color: #0000ff;">下面是这几个设置的一些背景知识：</span></p>
<div style="font-size: 12px; filter: none; visibility: visible; line-height: normal; word-wrap: break-word;">
<li style="line-height: normal;"><span style="line-height: normal; color: #0000ff;"><strong style="line-height: normal;">堆(Heap)和非堆(Non-heap)内存</strong><br style="line-height: normal;" /> 按照官方的说法：“Java 虚拟机具有一个堆，堆是运行时数据区域，所有类实例和数组的内存均从此处分配。堆是在 Java  虚拟机启动时创建的。”“在JVM中堆之外的内存称为非堆内存(Non-heap  memory)”。可以看出JVM主要管理两种类型的内存：堆和非堆。简单来说堆就是Java代码可及的内存，是留给开发人员使用的；非堆就是JVM留给   自己用的，所以方法区、JVM内部处理或优化所需的内存(如JIT编译后的代码缓存)、每个类结构(如运行时常数池、字段和方法数据)以及方法和构造方法  的代码都在非堆内存中。</span></li>
<li style="line-height: normal;"><span style="line-height: normal; color: #0000ff;"><strong style="line-height: normal;">堆内存分配</strong><br style="line-height: normal;" /> JVM初始分配的内存由-Xms指定，默认是物理内存的1/64；JVM最  大分配的内存由-Xmx指定，默认是物理内存的1/4。默认空余堆内存小于40%时，JVM就会增大堆直到-Xmx的最大限制；空余堆内存大于70%时，  JVM会减少堆直到-Xms的最小限制。因此服务器一般设置-Xms、-Xmx相等以避免在每次GC 后调整堆的大小。</span></li>
<li style="line-height: normal;"><span style="line-height: normal; color: #0000ff;"><strong style="line-height: normal;">非堆内存分配</strong><br style="line-height: normal;" /> JVM使用-XX:PermSize设置非堆内存初始值，默认是物理内存的1/64；由XX:MaxPermSize设置最大非堆内存的大小，默认是物理内存的1/4。</span></li>
<li style="line-height: normal;"><span style="line-height: normal; color: #0000ff;"><strong style="line-height: normal;">JVM内存限制(最大值)</strong><br style="line-height: normal;" /> 首先JVM内存首先受限于实际的最大物理内存，假设物理内存无限  大的话，JVM内存的最大值跟操作系统有很大的关系。简单的说就32位处理器虽然可控内存空间有4GB,但是具体的操作系统会给一个限制，这个限制一般是  2GB-3GB（一般来说Windows系统下为1.5G-2G，Linux系统下为2G-3G），而64bit以上的处理器就不会有限制了</span></li>
</div>
<p></span></p>
<p style="line-height: normal;"><span style="line-height: normal;">JVM</span><span style="line-height: normal;">内存的调优</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">1. Heap</span><span style="line-height: normal;">设定与垃圾回收</span><span style="line-height: normal;">Java Heap</span><span style="line-height: normal;">分为</span><span style="line-height: normal;">3</span><span style="line-height: normal;">个区，</span><span style="line-height: normal;">Young</span><span style="line-height: normal;">，</span><span style="line-height: normal;">Old</span><span style="line-height: normal;">和</span><span style="line-height: normal;">Permanent</span><span style="line-height: normal;">。</span><span style="line-height: normal;">Young</span><span style="line-height: normal;">保存刚实例化的对象。当该区被填满时，</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">会将对象移到</span><span style="line-height: normal;">Old</span><span style="line-height: normal;">区。</span><span style="line-height: normal;">Permanent</span><span style="line-height: normal;">区则负责保存反射对象，本文不讨论该区。</span><span style="line-height: normal;">JVM</span><span style="line-height: normal;">的</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">分配可以使用</span><span style="line-height: normal;">-X</span><span style="line-height: normal;">参数设定，</span></p>
<table style="table-layout: auto; width: 609px; line-height: normal;" border="0" cellspacing="0" cellpadding="0" width="90%">
<tbody style="line-height: normal;">
<tr style="line-height: normal;">
<td style="padding: 1.5pt; font-size: 12px; filter: none; visibility: visible; line-height: normal; word-wrap: break-word;">
<p style="line-height: normal;"><span style="line-height: normal;">-Xms</span></p>
</td>
<td style="padding: 1.5pt; font-size: 12px; filter: none; visibility: visible; line-height: normal; word-wrap: break-word;">
<p style="line-height: normal;"><span style="line-height: normal;">初始</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">大小</span></p>
</td>
</tr>
<tr style="line-height: normal;">
<td style="padding: 1.5pt; font-size: 12px; filter: none; visibility: visible; line-height: normal; word-wrap: break-word;">
<p style="line-height: normal;"><span style="line-height: normal;">-Xmx</span></p>
</td>
<td style="padding: 1.5pt; font-size: 12px; filter: none; visibility: visible; line-height: normal; word-wrap: break-word;">
<p style="line-height: normal;"><span style="line-height: normal;">java heap</span><span style="line-height: normal;">最大值</span></p>
</td>
</tr>
<tr style="line-height: normal;">
<td style="padding: 1.5pt; font-size: 12px; filter: none; visibility: visible; line-height: normal; word-wrap: break-word;">
<p style="line-height: normal;"><span style="line-height: normal;">-Xmn</span></p>
</td>
<td style="padding: 1.5pt; font-size: 12px; filter: none; visibility: visible; line-height: normal; word-wrap: break-word;">
<p style="line-height: normal;"><span style="line-height: normal;">young generation</span><span style="line-height: normal;">的</span><span style="line-height: normal;">heap</span><span style="line-height: normal;">大小</span></p>
</td>
</tr>
</tbody>
</table>
<p style="line-height: normal;"><span style="line-height: normal;">JVM</span><span style="line-height: normal;">有</span><span style="line-height: normal;">2</span><span style="line-height: normal;">个</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">线程。第一个线程负责回收</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">的</span><span style="line-height: normal;">Young</span><span style="line-height: normal;">区。第二个线程在</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">不足时，遍历</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">，将</span><span style="line-height: normal;">Young </span><span style="line-height: normal;">区升级为</span><span style="line-height: normal;">Older</span><span style="line-height: normal;">区。</span><span style="line-height: normal;">Older</span><span style="line-height: normal;">区的大小等于</span><span style="line-height: normal;">-Xmx</span><span style="line-height: normal;">减去</span><span style="line-height: normal;">-Xmn</span><span style="line-height: normal;">，不能将</span><span style="line-height: normal;">-Xms</span><span style="line-height: normal;">的值设的过大，因为第二个线程被迫运行会降低</span><span style="line-height: normal;">JVM</span><span style="line-height: normal;">的性能。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">为什么一些程序频繁发生</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">？有如下原因：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">l </span><span style="line-height: normal;">程序内调用了</span><span style="line-height: normal;">System.gc()</span><span style="line-height: normal;">或</span><span style="line-height: normal;">Runtime.gc()</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">l </span><span style="line-height: normal;">一些中间件软件调用自己的</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">方法，此时需要设置参数禁止这些</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">l         Java</span><span style="line-height: normal;">的</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">太小，一般默认的</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">值都很小。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">l </span><span style="line-height: normal;">频繁实例化对象，</span><span style="line-height: normal;">Release</span><span style="line-height: normal;">对象。此时尽量保存并重用对象，例如使用</span><span style="line-height: normal;">StringBuffer()</span><span style="line-height: normal;">和</span><span style="line-height: normal;">String()</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;"> </span><span style="line-height: normal;">如果你发现每次</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">后，</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">的剩余空间会是总空间的</span><span style="line-height: normal;">50%</span><span style="line-height: normal;">，这表示你的</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">处于健康状态。许多</span><span style="line-height: normal;">Server</span><span style="line-height: normal;">端的</span><span style="line-height: normal;">Java</span><span style="line-height: normal;">程序每次</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">后最好能有</span><span style="line-height: normal;">65%</span><span style="line-height: normal;">的剩余空间。经验之谈：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">1</span><span style="line-height: normal;">．</span><span style="line-height: normal;">Server</span><span style="line-height: normal;">端</span><span style="line-height: normal;">JVM</span><span style="line-height: normal;">最好将</span><span style="line-height: normal;">-Xms</span><span style="line-height: normal;">和</span><span style="line-height: normal;">-Xmx</span><span style="line-height: normal;">设为相同值。为了优化</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">，最好让</span><span style="line-height: normal;">-Xmn</span><span style="line-height: normal;">值约等于</span><span style="line-height: normal;">-Xmx</span><span style="line-height: normal;">的</span><span style="line-height: normal;">1/3[2]</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">2</span><span style="line-height: normal;">．一个</span><span style="line-height: normal;">GUI</span><span style="line-height: normal;">程序最好是每</span><span style="line-height: normal;">10</span><span style="line-height: normal;">到</span><span style="line-height: normal;">20</span><span style="line-height: normal;">秒间运行一次</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">，每次在半秒之内完成</span><span style="line-height: normal;">[2]</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">注意：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">1</span><span style="line-height: normal;">．增加</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">的大小虽然会降低</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">的频率，但也增加了每次</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">的时间。并且</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">运行时，所有的用户线程将暂停，也就是</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">期间，</span><span style="line-height: normal;">Java</span><span style="line-height: normal;">应用程序不做任何工作。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">2</span><span style="line-height: normal;">．</span><span style="line-height: normal;">Heap</span><span style="line-height: normal;">大小并不决定进程的内存使用量。进程的内存使用量要大于</span><span style="line-height: normal;">-Xmx</span><span style="line-height: normal;">定义的值，因为</span><span style="line-height: normal;">Java</span><span style="line-height: normal;">为其他任务分配内存，例如每个线程的</span><span style="line-height: normal;">Stack</span><span style="line-height: normal;">等。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">2</span><span style="line-height: normal;">．</span><span style="line-height: normal;">Stack</span><span style="line-height: normal;">的设定</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">每个线程都有他自己的</span><span style="line-height: normal;">Stack</span><span style="line-height: normal;">。</span></p>
<table style="table-layout: auto; width: 607px; line-height: normal; background-color: #eeccff;" border="1" cellspacing="0" cellpadding="0" width="90%">
<tbody style="line-height: normal;">
<tr style="line-height: normal;">
<td style="padding: 1.5pt; font-size: 12px; filter: none; visibility: visible; line-height: normal; word-wrap: break-word;">
<p style="line-height: normal;"><span style="line-height: normal;">-Xss</span></p>
</td>
<td style="padding: 1.5pt; font-size: 12px; filter: none; visibility: visible; line-height: normal; word-wrap: break-word;">
<p style="line-height: normal;"><span style="line-height: normal;">每个线程的</span><span style="line-height: normal;">Stack</span><span style="line-height: normal;">大小</span></p>
</td>
</tr>
</tbody>
</table>
<p style="line-height: normal;"><span style="line-height: normal;">Stack</span><span style="line-height: normal;">的大小限制着线程的数量。如果</span><span style="line-height: normal;">Stack</span><span style="line-height: normal;">过大就好导致内存溢漏。</span><span style="line-height: normal;">-Xss</span><span style="line-height: normal;">参数决定</span><span style="line-height: normal;">Stack</span><span style="line-height: normal;">大小，例如</span><span style="line-height: normal;">-Xss1024K</span><span style="line-height: normal;">。如果</span><span style="line-height: normal;">Stack</span><span style="line-height: normal;">太小，也会导致</span><span style="line-height: normal;">Stack</span><span style="line-height: normal;">溢漏。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">3</span><span style="line-height: normal;">．硬件环境</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">硬件环境也影响</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">的效率，例如机器的种类，内存，</span><span style="line-height: normal;">swap</span><span style="line-height: normal;">空间，和</span><span style="line-height: normal;">CPU</span><span style="line-height: normal;">的数量。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">如果你的程序需要频繁创建很多</span><span style="line-height: normal;">transient</span><span style="line-height: normal;">对象，会导致</span><span style="line-height: normal;">JVM</span><span style="line-height: normal;">频繁</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">。这种情况你可以增加机器的内存，来减少</span><span style="line-height: normal;">Swap</span><span style="line-height: normal;">空间的使用</span><span style="line-height: normal;">[2]</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">4</span><span style="line-height: normal;">．</span><span style="line-height: normal;">4</span><span style="line-height: normal;">种</span><span style="line-height: normal;">GC</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">第一种为单线程</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">，也是默认的</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">。，该</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">适用于单</span><span style="line-height: normal;">CPU</span><span style="line-height: normal;">机器。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">第二种为</span><span style="line-height: normal;">Throughput GC</span><span style="line-height: normal;">，是多线程的</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">，适用于多</span><span style="line-height: normal;">CPU</span><span style="line-height: normal;">，使用大量线程的程序。第二种</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">与第一种</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">相似，不同在于</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">在收集</span><span style="line-height: normal;">Young</span><span style="line-height: normal;">区是多线程的，但在</span><span style="line-height: normal;">Old</span><span style="line-height: normal;">区和第一种一样，仍然采用单线程。</span><span style="line-height: normal;">-XX:+UseParallelGC</span><span style="line-height: normal;">参数启动该</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">第三种为</span><span style="line-height: normal;">Concurrent Low Pause GC</span><span style="line-height: normal;">，类似于第一种，适用于多</span><span style="line-height: normal;">CPU</span><span style="line-height: normal;">，并要求缩短因</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">造成程序停滞的时间。这种</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">可以在</span><span style="line-height: normal;">Old</span><span style="line-height: normal;">区的回收同时，运行应用程序。</span><span style="line-height: normal;">-XX:+UseConcMarkSweepGC</span><span style="line-height: normal;">参数启动该</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">第四种为</span><span style="line-height: normal;">Incremental Low Pause GC</span><span style="line-height: normal;">，适用于要求缩短因</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">造成程序停滞的时间。这种</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">可以在</span><span style="line-height: normal;">Young</span><span style="line-height: normal;">区回收的同时，回收一部分</span><span style="line-height: normal;">Old</span><span style="line-height: normal;">区对象。</span><span style="line-height: normal;">-Xincgc</span><span style="line-height: normal;">参数启动该</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">4</span><span style="line-height: normal;">种</span><span style="line-height: normal;">GC</span><span style="line-height: normal;">的具体描述参见</span><span style="line-height: normal;">[3]</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">参考文章：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">1. JVM Tuning. http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp#garbage-collection</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">2. Performance tuning Java: Tuning steps</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,1604,00.html</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">3. Tuning Garbage Collection with the 1.4.2 JavaTM Virtual Machine .</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">http://java.sun.com/docs/hotspot/gc1.4.2/</span></p>
<p style="line-height: normal;"><strong style="line-height: normal;"><span style="line-height: normal;">二．</span><span style="line-height: normal;">Tomcat</span></strong><strong style="line-height: normal;"><span style="line-height: normal;">配置</span></strong></p>
<p style="line-height: normal;"><span style="line-height: normal;">问题分析：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;"> 由于</span><span style="line-height: normal;">TOMCAT</span><span style="line-height: normal;">内存溢出而引发的问题，主要原因是</span><span style="line-height: normal;">JVM</span><span style="line-height: normal;">的虚拟内存默认为</span><span style="line-height: normal;">128M</span><span style="line-height: normal;">，当超过这个值时就把先前占用的内存释放，而导致好象</span><span style="line-height: normal;">TCP/IP</span><span style="line-height: normal;">丢包的假象，出现</span><span style="line-height: normal;">HTTP500</span><span style="line-height: normal;">的错误。解决方法主要是加大</span><span style="line-height: normal;">TOMCAT</span><span style="line-height: normal;">可利用内存，并在程序当中加大内存使用。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">解决方法：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">方法：加大</span><span style="line-height: normal;">TOMCAT</span><span style="line-height: normal;">可利用内存：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;"> 在</span><span style="line-height: normal;">TOMCAT</span><span style="line-height: normal;">的目录下，也就是在</span><span style="line-height: normal;">TOMCAT41/bin/catalina.bat</span><span style="line-height: normal;">文件最前面加入</span></p>
<p style="line-height: normal;"><span style="line-height: normal;"> </span><span style="line-height: normal;">set JAVA_OPTS=-Xms800m -Xmx800m</span></p>
<p style="line-height: normal;"><span style="line-height: normal;"> 表现效果是当你启动</span><span style="line-height: normal;">TOMCAT</span><span style="line-height: normal;">时，系统内存会增加近</span><span style="line-height: normal;">800M</span><span style="line-height: normal;">使用</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">操作方法：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;"> </span><span style="line-height: normal;">1</span><span style="line-height: normal;">）、先关掉</span><span style="line-height: normal;">WINDOWS</span><span style="line-height: normal;">服务当中的</span><span style="line-height: normal;">TOMCAT4</span><span style="line-height: normal;">服务。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;"> </span><span style="line-height: normal;">2</span><span style="line-height: normal;">）、再找到</span><span style="line-height: normal;">TOMCAT/BIN</span><span style="line-height: normal;">目录下</span><span style="line-height: normal;">startup.bat</span><span style="line-height: normal;">，双击打开它，你会发现现</span><span style="line-height: normal;">WINDOWS</span><span style="line-height: normal;">内存占用会增加近</span><span style="line-height: normal;">800M</span><span style="line-height: normal;">。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;"> </span><span style="line-height: normal;">3</span><span style="line-height: normal;">）、执行程序，因为是</span><span style="line-height: normal;">TOMCAT</span><span style="line-height: normal;">重新编译程序，所以第一次会比较慢。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">结论：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">经过测试，我们得出如下数据：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">当系统传输约</span><span style="line-height: normal;">2000</span><span style="line-height: normal;">条数据时，大约近</span><span style="line-height: normal;">12M</span><span style="line-height: normal;">的净数据（不压缩时），系统辅助运行的内存大约占用</span><span style="line-height: normal;">150M</span><span style="line-height: normal;">左右的空间，也就是近</span><span style="line-height: normal;">200M</span><span style="line-height: normal;">的内存占用，而我们扩大了近</span><span style="line-height: normal;">800M</span><span style="line-height: normal;">的</span><span style="line-height: normal;">JAVA</span><span style="line-height: normal;">内存使用，这对于业务本身来说是足够了。所以你们不用担心大数据量的传递问题。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">基于</span><span style="line-height: normal;">JAVA</span><span style="line-height: normal;">虚拟机的原理，</span><span style="line-height: normal;">JAVA</span><span style="line-height: normal;">自动有垃圾回收机制，也就是在你对一些内存长时间不使用时（近</span><span style="line-height: normal;">2</span><span style="line-height: normal;">分钟，取决于使用频度和优先级等），就会自动垃圾回收，从而释放不用的内存占用。</span></p>
<p style="line-height: normal;"><strong style="line-height: normal;"><span style="line-height: normal;">三</span><span style="line-height: normal;">.WebLogic</span></strong><strong style="line-height: normal;"><span style="line-height: normal;">配置：</span></strong></p>
<p style="line-height: normal;"><span style="line-height: normal;">由于</span><span style="line-height: normal;">WebLogic</span><span style="line-height: normal;">的配置问题，我们的测试出现了失败情况。原因是为</span><span style="line-height: normal;">WebLogic</span><span style="line-height: normal;">分配的内存太少了。通过修改</span><span style="line-height: normal;">commom\bin\commEnv.cmd</span><span style="line-height: normal;">文件来增加内存分配。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">修改的部分如下：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">:bea</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">if &#8220;%PRODUCTION_MODE%&#8221; == &#8220;true&#8221; goto bea_prod_mode</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">set JAVA_VM=-jrockit</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">set MEM_ARGS=-Xms768m -Xmx1024m</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">set JAVA_OPTIONS=%JAVA_OPTIONS% -Xverify:none</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">goto continue</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">:bea_prod_mode</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">set JAVA_VM=-jrockit</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">set MEM_ARGS=-Xms768m -Xmx1024m//</span><span style="line-height: normal;">原来是</span><span style="line-height: normal;">128M</span><span style="line-height: normal;">~256M</span><span style="line-height: normal;">，太小了，数据太大</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">goto continue</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">结果修改后，没有效果。还是有失败的情况。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">发现，原来，在：</span><span style="line-height: normal;">bea</span><span style="line-height: normal;">下面还有一段配置信息如下：</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">:sun</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">if &#8220;%PRODUCTION_MODE%&#8221; == &#8220;true&#8221; goto sun_prod_mode</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">set JAVA_VM=-client</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">set MEM_ARGS=-Xms768m -Xmx1024m -XX:MaxPermSize=256m</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">set JAVA_OPTIONS=%JAVA_OPTIONS% -Xverify:none</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">goto continue</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">:sun_prod_mode</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">set JAVA_VM=-server</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">set MEM_ARGS=-Xms768m -Xmx1024m -XX:MaxPermSize=256m</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">goto continue</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">将这里的内存分配修改后见效。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">原因是，上面对第一段代码是为</span><span style="line-height: normal;">bea</span><span style="line-height: normal;">自己的</span><span style="line-height: normal;">JVM</span><span style="line-height: normal;">设置的，下面的是为</span><span style="line-height: normal;">Sun</span><span style="line-height: normal;">的设置的。而</span><span style="line-height: normal;">WebLogic</span><span style="line-height: normal;">默认的是</span><span style="line-height: normal;">Sun</span><span style="line-height: normal;">的，所以出了毛病。在</span><span style="line-height: normal;">JDK</span><span style="line-height: normal;">的选择上，</span><span style="line-height: normal;">weblogic</span><span style="line-height: normal;">有两种</span><span style="line-height: normal;">JDK</span><span style="line-height: normal;">供选择，一种是</span><span style="line-height: normal;">Sun</span><span style="line-height: normal;">的</span><span style="line-height: normal;">JDK</span><span style="line-height: normal;">，另外一种是</span><span style="line-height: normal;">Bea</span><span style="line-height: normal;">的</span><span style="line-height: normal;">jrockit</span><span style="line-height: normal;">。按照</span><span style="line-height: normal;">bea</span><span style="line-height: normal;">的网站的说明，</span><span style="line-height: normal;">sun jdk</span><span style="line-height: normal;">提供更好的兼容性，而使用</span><span style="line-height: normal;">jrockit</span><span style="line-height: normal;">可以提供更好的性能。作为</span><span style="line-height: normal;">weblogic</span><span style="line-height: normal;">集群我全部采用</span><span style="line-height: normal;">jrockit</span><span style="line-height: normal;">作为</span><span style="line-height: normal;">JDK</span><span style="line-height: normal;">环境，以达到更高的性能。</span></p>
<p style="line-height: normal;"><span style="line-height: normal;">在默认启动情况下，</span><span style="line-height: normal;">jrockit</span><span style="line-height: normal;">启动时为其窗口配置的内存大小比较小。注意</span><span style="line-height: normal;">weblogic</span><span style="line-height: normal;">的启动内存配置</span><span style="line-height: normal;">-Xms32m -Xmx256m</span><span style="line-height: normal;">，通过修改</span><span style="line-height: normal;">commEnv.sh</span><span style="line-height: normal;">可以修改这个参数，</span><span style="line-height: normal;">Xms</span><span style="line-height: normal;">表示启动开始分配的内存，</span><span style="line-height: normal;">Xmx</span><span style="line-height: normal;">表示最大能分配的内存，这里我们根据应用情况调整为</span><span style="line-height: normal;">-Xms1536m -Xmx1536m</span><span style="line-height: normal;">，这点需要根据自身测试情况和系统配置进行调整，经过周一晚的调试，我们目前应用比较合理的窗口内存大小为</span><span style="line-height: normal;">1536M</span><span style="line-height: normal;">（</span><span style="line-height: normal;">2G</span><span style="line-height: normal;">×</span><span style="line-height: normal;"> 75</span><span style="line-height: normal;">％），通过</span><span style="line-height: normal;">top</span><span style="line-height: normal;">可以观察到测试中的内存反应，最合理的应该是恰好把物理内存用完。</span></p>
<p></span></div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.atongmu.cn/?feed=rss2&amp;p=6386</wfw:commentRss>
		</item>
		<item>
		<title>log4net的配置方法</title>
		<link>http://www.atongmu.cn/?p=6367</link>
		<comments>http://www.atongmu.cn/?p=6367#comments</comments>
		<pubDate>Thu, 15 Jul 2010 18:12:54 +0000</pubDate>
		<dc:creator>噪音有害健康</dc:creator>
		
		<category><![CDATA[技术片段]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[log4net]]></category>

		<category><![CDATA[网络游戏]]></category>

		<category><![CDATA[配置方法]]></category>

		<guid isPermaLink="false">http://www.atongmu.cn/?p=6367</guid>
		<description><![CDATA[看了网上很多例子，自己配置本地可以，经常发布到生产环境下还是不行，探索后发现有几个地方是关键，红色标记出来了，下面就具体说说看：]]></description>
			<content:encoded><![CDATA[<p><strong>看了网上很多例子，自己配置本地可以，经常发布到生产环境下还是不行，探索后发现有几个地方是关键，红色标记出来了，下面就具体说说看：</strong></p>
<p>1。添加log4net.dll的引用，dll文件请自行下载。</p>
<p>2。web.config中添加（注意放对位置，在configSections标签内）</p>
<p><span style="color: #000080;">&lt;configSections&gt;<br />
&lt;section name=&#8221;log4net&#8221;<br />
type=&#8221;log4net.Config.Log4NetConfigurationSectionHandler,log4net-net-1.0&#8243;<br />
/&gt;<br />
&lt;/configSections&gt; </span></p>
<p><span style="color: #000080;"><br />
</span> <span style="color: #000080;"> &lt;log4net&gt;<br />
&lt;root&gt;<br />
&lt;level value=&#8221;ALL&#8221; /&gt;<br />
&lt;appender-ref ref=&#8221;LogFileAppender&#8221; /&gt;<br />
&lt;/root&gt; </span></p>
<p><span style="color: #000080;"> &lt;appender name=&#8221;LogFileAppender&#8221;   type=&#8221;log4net.Appender.FileAppender&#8221; &gt;<br />
&lt;param name=&#8221;File&#8221; value=&#8221;log.txt&#8221; /&gt;<br />
&lt;param name=&#8221;AppendToFile&#8221; value=&#8221;true&#8221; /&gt;<br />
&lt;layout type=&#8221;log4net.Layout.PatternLayout&#8221;&gt;<br />
&lt;param name=&#8221;ConversionPattern&#8221;  value=&#8221;%d [%t] %-5p %c [%x]  &amp;lt;%X{auth}&amp;gt;%n - %m%n&#8221; /&gt;<br />
&lt;/layout&gt;<br />
&lt;/appender&gt;<br />
&lt;/log4net&gt;</span></p>
<p>3。<span style="color: #ff0000;">在应用程序代码中读取配置（注意此步特别重要！！）</span></p>
<p>3.1。在项目的AssemblyInfo.cs文件中添加（注意放对位置，放在命名空间外）<br />
<code>[assembly:log4net.Config.DOMConfigurator( ConfigFile="Web.config",Watch=true)]</code></p>
<p>3.2。在Global.asax.cs中添加（位置也是在命名空间外）<br />
<code>[assembly:log4net.Config.DOMConfigurator( ConfigFile="Web.config",Watch=true)]</code></p>
<p>3.3。直接在要记录日志的页面文件的cs文件里加<br />
<code>[assembly:log4net.Config.DOMConfigurator( ConfigFile="Web.config",Watch=true)]</code></p>
<p>4。在cs文件中page_Load中init<br />
<code>log4net.ILog log = log4net.LogManager.GetLogger("MyLogger");</code></p>
<p>具体使用<br />
<code>log.Debug("Who am i");</code></p>
<p>5。 在生产环境下，windows   2003   server上需要给NETWORK   SERVICE用户对日志目录的读写权限，否则log4net在该环境下不能正常工作。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.atongmu.cn/?feed=rss2&amp;p=6367</wfw:commentRss>
		</item>
		<item>
		<title>linux环境下文件名乱码的文件名修改方法</title>
		<link>http://www.atongmu.cn/?p=6365</link>
		<comments>http://www.atongmu.cn/?p=6365#comments</comments>
		<pubDate>Thu, 15 Jul 2010 17:56:35 +0000</pubDate>
		<dc:creator>噪音有害健康</dc:creator>
		
		<category><![CDATA[技术片段]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[中文文件名]]></category>

		<category><![CDATA[乱码]]></category>

		<category><![CDATA[修改文件名]]></category>

		<guid isPermaLink="false">http://www.atongmu.cn/?p=6365</guid>
		<description><![CDATA[比如我的目录有这样一个文件：
-rw-r&#8211;r&#8211;  1 root root  90445 Jul  9 21:11 è¶…å£°æ³¢æ¸…æ´—å™¨HL405-a.jpg
基本思路是使用find 先找到，然后进行改名：
find . -size 90445c -exec mv {} HL405-a.jpg \;
说明:
find . -size 90445c 这是寻找目标，90445c ，就是你上面看到的文件的大小，
-exec mv {} HL405-a.jpg \;  这里是将找到的文件进行改名，{}这里代笔的就是找到的文件名，记得必须在后面加上 \; 否则出错！
]]></description>
			<content:encoded><![CDATA[<p>比如我的目录有这样一个文件：</p>
<p>-rw-r&#8211;r&#8211;  1 root root  90445 Jul  9 21:11 è¶…å£°æ³¢æ¸…æ´—å™¨HL405-a.jpg</p>
<p>基本思路是使用find 先找到，然后进行改名：</p>
<p><code>find . -size 90445c -exec mv {} HL405-a.jpg \;</code></p>
<p>说明:<br />
find . -size 90445c 这是寻找目标，90445c ，就是你上面看到的文件的大小，<br />
-exec mv {} HL405-a.jpg \;  这里是将找到的文件进行改名，{}这里代笔的就是找到的文件名，记得必须在后面加上 \; 否则出错！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.atongmu.cn/?feed=rss2&amp;p=6365</wfw:commentRss>
		</item>
		<item>
		<title>ROR学习笔记</title>
		<link>http://www.atongmu.cn/?p=6352</link>
		<comments>http://www.atongmu.cn/?p=6352#comments</comments>
		<pubDate>Sat, 10 Jul 2010 23:03:40 +0000</pubDate>
		<dc:creator>噪音有害健康</dc:creator>
		
		<category><![CDATA[技术片段]]></category>

		<category><![CDATA[ror]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[Ruby On Rails]]></category>

		<category><![CDATA[学习笔记]]></category>

		<guid isPermaLink="false">http://www.atongmu.cn/?p=6352</guid>
		<description><![CDATA[水滴石穿]]></description>
			<content:encoded><![CDATA[<p>1。 创建应用程序</p>
<p>脚本<br />
<code>rails application_name</code></p>
<p>2。创建数据库</p>
<p>通过配置config/database.yml文件实现</p>
<p>3。 创建数据库表</p>
<p>脚本<br />
<code>ruby script/generate scaffold table_name field_name1:field_type field_name2:field_type</code></p>
<p>执行<br />
<code>rake db:migrate</code></p>
<p>4。增加字段</p>
<p>脚本<br />
<code>ruby script/generate migration add_fieldname_to_tablename field_name:field_type</code></p>
<p>执行<br />
<code>rake db:migrate</code></p>
<p>5。创建一个控制器</p>
<p>脚本</p>
<p><code>ruby script/generate controller controller_name action_name</code></p>
<p>6。创建数据库存储的SESSION</p>
<p>脚本<br />
<code>rake db:sessions:create</code></p>
<p>执行<br />
<code>rake db:migrate</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.atongmu.cn/?feed=rss2&amp;p=6352</wfw:commentRss>
		</item>
		<item>
		<title>CSS相关资源收集</title>
		<link>http://www.atongmu.cn/?p=6347</link>
		<comments>http://www.atongmu.cn/?p=6347#comments</comments>
		<pubDate>Sat, 15 May 2010 16:28:17 +0000</pubDate>
		<dc:creator>噪音有害健康</dc:creator>
		
		<category><![CDATA[技术片段]]></category>

		<guid isPermaLink="false">http://www.atongmu.cn/?p=6347</guid>
		<description><![CDATA[http://csscreator.com/version2/pagelayout.php
http://www.emptees.com/tees/4373-1997
t-shirt 创意
http://www.qianduan.net/
]]></description>
			<content:encoded><![CDATA[<p>http://csscreator.com/version2/pagelayout.php</p>
<p>http://www.emptees.com/tees/4373-1997<br />
t-shirt 创意</p>
<p>http://www.qianduan.net/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.atongmu.cn/?feed=rss2&amp;p=6347</wfw:commentRss>
		</item>
		<item>
		<title>黑色风格设计的网站收藏</title>
		<link>http://www.atongmu.cn/?p=6343</link>
		<comments>http://www.atongmu.cn/?p=6343#comments</comments>
		<pubDate>Sat, 15 May 2010 16:03:09 +0000</pubDate>
		<dc:creator>噪音有害健康</dc:creator>
		
		<category><![CDATA[技术片段]]></category>

		<guid isPermaLink="false">http://www.atongmu.cn/?p=6343</guid>
		<description><![CDATA[http://www.taptapas.com/
http://www.adorecheaperbills.co.uk/
http://www.rodeopark.se/
http://cabedge.com/
http://r.fm/
http://design-newz.com/
http://anderbose.com/
http://www.briterevolution.com/
http://antonpeck.com/
http://www.harryjh.com/
http://www.aifosvn.com/
http://www.oysterdesign.co.uk/
http://www.twigkit.com/
http://ismaelburciaga.com/
http://dezinezync.com/
http://www.socialcontrol.com/
http://greencircleshoppingcenter.com/
http://www.leightaylor.co.uk/
http://nataliadevalle.com.ar/
http://www.tictocfamily.com/
http://twelve-restaurant.co.uk/
http://www.383project.com/
http://blackestate.co.nz/
http://creativenights.com/
http://madebygiant.com/
http://janpostma.com/
http://mediocore.cz/
http://vanillapearl.com/
http://tobolic.com/
http://www.justincline.com/
http://www.nativetongue.com.au/
http://www.edit-studios.com/
http://www.takethewalk.net/
http://brandstorm.pl/index.htm
http://www.kurtgannon.com/
http://www.getbackboard.com/
http://www.letitbleedbook.com/
http://www.subcontrast.com/
]]></description>
			<content:encoded><![CDATA[<p>http://www.taptapas.com/</p>
<p>http://www.adorecheaperbills.co.uk/</p>
<p>http://www.rodeopark.se/</p>
<p>http://cabedge.com/</p>
<p>http://r.fm/</p>
<p>http://design-newz.com/</p>
<p>http://anderbose.com/</p>
<p>http://www.briterevolution.com/</p>
<p>http://antonpeck.com/</p>
<p>http://www.harryjh.com/</p>
<p>http://www.aifosvn.com/</p>
<p>http://www.oysterdesign.co.uk/</p>
<p>http://www.twigkit.com/</p>
<p>http://ismaelburciaga.com/</p>
<p>http://dezinezync.com/</p>
<p>http://www.socialcontrol.com/</p>
<p>http://greencircleshoppingcenter.com/</p>
<p>http://www.leightaylor.co.uk/</p>
<p>http://nataliadevalle.com.ar/</p>
<p>http://www.tictocfamily.com/</p>
<p>http://twelve-restaurant.co.uk/</p>
<p>http://www.383project.com/</p>
<p>http://blackestate.co.nz/</p>
<p>http://creativenights.com/</p>
<p>http://madebygiant.com/</p>
<p>http://janpostma.com/</p>
<p>http://mediocore.cz/</p>
<p>http://vanillapearl.com/</p>
<p>http://tobolic.com/</p>
<p>http://www.justincline.com/</p>
<p>http://www.nativetongue.com.au/</p>
<p>http://www.edit-studios.com/</p>
<p>http://www.takethewalk.net/</p>
<p>http://brandstorm.pl/index.htm</p>
<p>http://www.kurtgannon.com/</p>
<p>http://www.getbackboard.com/</p>
<p>http://www.letitbleedbook.com/</p>
<p>http://www.subcontrast.com/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.atongmu.cn/?feed=rss2&amp;p=6343</wfw:commentRss>
		</item>
		<item>
		<title>十大即将消失的绝世美景</title>
		<link>http://www.atongmu.cn/?p=6341</link>
		<comments>http://www.atongmu.cn/?p=6341#comments</comments>
		<pubDate>Tue, 11 May 2010 15:22:16 +0000</pubDate>
		<dc:creator>kahn</dc:creator>
		
		<category><![CDATA[历史尘埃]]></category>

		<category><![CDATA[旅游]]></category>

		<category><![CDATA[景观]]></category>

		<category><![CDATA[环保]]></category>

		<category><![CDATA[破坏]]></category>

		<category><![CDATA[美景]]></category>

		<guid isPermaLink="false">http://www.atongmu.cn/?p=6341</guid>
		<description><![CDATA[　　十大即将消失的绝世美景……]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="喀纳斯" src="http://img1.gtimg.com/news/pics/hv1/127/234/512/33352597.jpg" alt="" width="400" height="241" /><br />
<strong style="color:#C00;">喀纳斯</strong></p>
<p>喀纳斯：那霏霏细雪里阿尔泰山脉下哈流滩草原哈萨克牧民的转场，寒雨里哈那斯湖、卧龙湾、月亮湾饱和浓重的斑斓秋色，当时质朴原始的风情，一辈子不能忘 记。现在据说物价太高，商业化了不少。但相信那里，仍有中国西北最美之一的秋色。</p>
<p><img class="alignnone" title="甘南草原" src="http://img1.gtimg.com/news/pics/hv1/123/234/512/33352593.jpg" alt="" width="400" height="271" /><br />
<strong style="color:#C00;">甘南草原</strong></p>
<p>甘南草原：进入州府合作境内，油菜花的金黄与青稞田的嫩绿相间隔，大地象打泼了的调色板。玛曲附近，阿玛尼卿雪线下，无边的草原开满鲜花，牛羊象珍珠洒在 草原间。有黄河第一湾，摄影天堂郎木寺，黄教第一寺拉卜楞寺。浓郁的藏族风情和宗教色彩。参加了插箭节、耍坝子、赛马节等节庆，在草原上和当地妇女跳了锅 庄，看到了不少剪羊毛等浓郁的生活场景。尤其一个叫阿万仓的偏僻小镇上康巴汉子的剽悍俊朗和类似美国西部的野性气息让人难忘。自然与人文风光相得益彰，是 我对这里的终生印象。但这两年摄影者去得太多，已发展为较成熟的旅游区。很多东西开始在变了，比如听说桑科草原的牧民就商业化得厉害，处处张口要钱。</p>
<p><img class="alignnone" title="稻城亚丁" src="http://img1.gtimg.com/news/pics/hv1/122/234/512/33352592.jpg" alt="" width="400" height="409" /><br />
<strong style="color:#C00;">稻城亚丁</strong></p>
<p>遭遇了秋色与冬雪交织的奇丽景色。真是一个无愧于“五彩斑斓”这个成语的地方。那里的座座以菩萨美名为名的雪山，是迄今为止我看到的最美的雪山。雨雪过后 的清晨，彩色森林里云蒸霞蔚的壮丽，海子的那种蔚蓝，真是美得无法形容。从成都走川藏南线去沿途川西高原的雄险和秋色亦铭心刻骨。但这两年那里的物价涨得 飞快，一到节假日整个山林被旅行者填满。我的两个好友，都将生命留在了那里。</p>
<p>旅行稻城，危险系数比较大。今年四川省投入大量资金修路，最近刚通车，从日瓦乡已直接能将底盘最低的夏利开到亚丁村啦。</p>
<p><img class="alignnone" title="泸沽湖" src="http://img1.gtimg.com/news/pics/hv1/121/234/512/33352591.jpg" alt="" width="400" height="320" /><br />
<strong style="color:#C00;">泸沽湖</strong></p>
<p>1993年10月底自己独访。当时的摩梭人已很有商业头脑，给我不是特别自然的印象。湖畔风景风情尚可。经过又10年的旅游包装，那里应该改变更大了。如 无特别原因，我是不会重返的。</p>
<p><img class="alignnone" title="怒江峡谷" src="http://img1.gtimg.com/news/pics/hv1/120/234/512/33352590.jpg" alt="" width="300" height="400" /><br />
<strong style="color:#C00;">怒江峡谷</strong></p>
<p>今年春节刚回来。整个怒江峡谷水土流失情况不容乐观。但冬天怒江水非常温柔碧蓝。峡谷有木棉和油菜花点缀，世外桃源。傈僳族的澡塘会真的很率性欢快。徒步 进秋那桶村、五里寨，怒族藏族农家盘桓了几天，深受感动。这是我目前到过的最纯朴最优美的人间净土。旅行至此，已无遗憾。</p>
<p><img class="alignnone" title="黔东南" src="http://img1.gtimg.com/news/pics/hv1/106/234/512/33352576.jpg" alt="" width="292" height="196" /><br />
<strong style="color:#C00;">黔东南</strong></p>
<p>2001年春节在那的侗家过年，2002年元旦又第二次造访。民风较为淳朴。鼓楼、风雨桥、干栏式吊脚楼、碧清的都柳江和榕江、一个个鳞次栉比的寨子，民 族习俗的东西保留较好。我们运气不错，听到寨子里纯正的多人合唱的侗族大歌。那里的风景不震撼，但值得细细品味。住在那里的农村里，是很写意的。</p>
<p>但最近去的人多了，听大歌要收钱了。我倒是在一个民俗研究生的论文里看到了另一个被成为“百里侗文化长廊”的地方——湖南与贵州、广西交界的通道县，侗家 风情浓郁、习俗保存完好，而且游人少至，一直想去。离黔东南很近，从龙胜北上90多公里即可达。</p>
<p><img class="alignnone" title="婺源和古徽州" src="http://img1.gtimg.com/news/pics/hv1/105/234/512/33352575.jpg" alt="" width="330" height="220" /><br />
<strong style="color:#C00;">婺源和古徽州</strong></p>
<p>婺源和古徽州：2000年深秋去的。很多村子已开始收门票。但这一带毕竟是文化底蕴非同寻常的地方，人文气息厚重，村民普遍有一种祖传下来的儒雅，不会咄 咄逼人。春秋两季，在桃花油菜花或红叶掩映的古村田园徜徉，心绪纷飞。适合住下来好好感受。</p>
<p>但建议不要节假日前往，旅行团会把那些老屋田园弄得吵嚷，让你无法产生那种“无梦到徽州”的情愫、怀旧的感伤和春秋花丛红叶点缀的“家园”的感觉。</p>
<p><img class="alignnone" title="浙南泰顺" src="http://img1.gtimg.com/news/pics/hv1/103/234/512/33352573.jpg" alt="" width="400" height="222" /><br />
<strong style="color:#C00;">浙南泰顺</strong></p>
<p>2002年3月独访。自己独行，一路搭拖拉机、摩托车、班车，在乡民指点下逐一造访廊桥、古村，寻访夹缬古法染布的老人和作坊，做客农家，被那深藏在崇山 峻岭间浓重的民俗和文化所深深感染。那些廊桥古村，建筑艺术令人倾倒。</p>
<p>早春时节，油菜花桃李花掩映的山乡里，民风极其质朴热诚。我一路受到很多照顾，此生难忘。不过村落廊桥间距离较远，有的需要步行始达，寻访得挺辛苦。与泰 顺相交的闽西北、浙江丽水一带都有美丽宁静的廊桥古村，有半月时间，一一寻访，保证让你回味无穷。</p>
<p><img class="alignnone" title="闽西土楼" src="http://img1.gtimg.com/news/pics/hv1/104/234/512/33352574.jpg" alt="" width="400" height="300" /><br />
<strong style="color:#C00;">闽西土楼</strong></p>
<p>历史上闽西经济较差，交通不甚便利，匪患械斗多发，客家人从黄河流域迁徙到这里后，为了便于群居以及抵御匪患，结合当时中原汉族建筑而创造出土楼这种奇特 建筑，充分体现了经济性、坚固性、防御性、艺术性的思想。</p>
<p><img class="alignnone" title="阿坝高原" src="http://img1.gtimg.com/news/pics/hv1/110/234/512/33352580.jpg" alt="" width="400" height="405" /><br />
<strong style="color:#C00;">阿坝高原</strong></p>
<p>租辆吉普车在川西北阿坝州和甘孜州等安多藏区和康巴藏区纵横九天，看降扎乡民演出的传统又正宗的藏戏，在齐沟坝牧场参加乡亲们的牧运会，露营于星光灿烂的 草原上，盘桓阿坝县诗歌一般的田园，穿行在大渡河源头壤塘的森林溪谷间，顶着骄阳在僧众过万、气势恢弘的色达佛学院金顶转经轮，翻越一座又一座神山，拍摄 处女般的新路海和卡萨湖、晚霞映红的雪山草甸，参拜寺庙，在紫花铺展到天边的草原上打滚，追逐雪白的羊群和如一盘黑豆撒在草坡上的牦牛群……那片经幡飘 荡、草海无边、河流弯弯的大地，虽然路途艰难，但又那么富饶美丽，没有被旅游所污染，是摄影家的天堂，更是她的藏族主人天然质朴的乐土，神灵的居所。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.atongmu.cn/?feed=rss2&amp;p=6341</wfw:commentRss>
		</item>
		<item>
		<title>Opera 10.10 for Linux中文字体及输入法的处理</title>
		<link>http://www.atongmu.cn/?p=6335</link>
		<comments>http://www.atongmu.cn/?p=6335#comments</comments>
		<pubDate>Sun, 02 May 2010 01:31:17 +0000</pubDate>
		<dc:creator>噪音有害健康</dc:creator>
		
		<category><![CDATA[技术片段]]></category>

		<category><![CDATA[推荐]]></category>

		<category><![CDATA[9.04]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Opera]]></category>

		<category><![CDATA[Opera 10.10]]></category>

		<category><![CDATA[ubuntu]]></category>

		<category><![CDATA[Unix]]></category>

		<category><![CDATA[中文字体]]></category>

		<category><![CDATA[中文输入法]]></category>

		<category><![CDATA[字体显示]]></category>

		<category><![CDATA[输入法]]></category>

		<guid isPermaLink="false">http://www.atongmu.cn/?p=6335</guid>
		<description><![CDATA[使用Linux上Opera经常遇见中文输入无法调出，中文显示字体大小不一的问题，很是苦恼，现在总结下具体的处理方式]]></description>
			<content:encoded><![CDATA[<p>使用Linux上Opera经常遇见中文输入无法调出，中文显示字体大小不一的问题，很是苦恼，现在总结下具体的处理方式。以下说明均在Ubunu 9.04环境下调试成功。</p>
<p>1、首先来看字体显示问题，这个问题需要我们去修改Opera的字体配置文件，我们去Opera的字体配置文件目录<br />
<code>/usr/share/opera/defaults/</code></p>
<p>2、在这个目录下找一个 font.ini 文件</p>
<p>3、编辑此文件，找到如下位置，修改优先选择的字体，见蓝色字体部分。<br />
<code>。。。。。。<br />
; Known fonts that solves specific problems<br />
;family:mincho|gothic=japanese good try-first<br />
<span style="color: #0000ff;">family:WenQuanYi Micro Hei=chinese-s excellent try-first<br />
family:WenQuanYi Micro Hei=chinese-s verygood try-first<br />
family:WenQuanYi Micro Hei=chinese-s good try-first</span><br />
;family:song|song ti|fangsong*=chinese-s try-first<br />
;family:baekmuk*=korean good try-first<br />
。。。。。。<br />
</code></p>
<p><span style="color: #ff0000;">注意：这里的WenQuanYi Micro Hei就是文泉驿微米黑字体，需要另外安装，如何安装请参考本站这篇文章：</span><br />
<a href="http://www.atongmu.cn/?p=6331" target="“_blank”">Ubuntu 9.04安装文泉驿微米黑字体</a></p>
<p>4、接着在“工具”→“首选项”→“高级”→“字体”中的“浏览器菜单”和“网页字体”都用上“文泉驿微米黑”，“网页</p>
<pre>”上选择“文泉驿等宽微米黑”。“国际字体”中选择“简体中文”。就大功告成了，看看效果吧：
<a href="http://www.atongmu.cn/wp-content/uploads/2010/05/new.png"><img class="aligncenter size-full wp-image-6338" title="opera 字体实例图" src="http://www.atongmu.cn/wp-content/uploads/2010/05/new.png" alt="opera 字体实例图" width="500" /></a></pre>
<p>5、下面来看看输入法，先安装scim-qtimm<br />
<code>sudo apt-get install scim-qtimm</code></p>
<p>6、接着修改opera的执行文件，这个很重要哦。<br />
<code>sudo gedit /usr/bin/opera</code></p>
<p>在这句话<br />
<code>OPERA_BINARYDIR=/usr/lib/opera</code><br />
之后加入</p>
<p><code>export export QT_IM_MODULE=SCIM</code></p>
<p>7、最后删除Ctrl+Space打开主页的快捷键即可，具体操作如下：<br />
在“工具”→“首选项”→“高级”→“快捷键”中，找到“Opera Standard”，点击编辑按钮，在Application中找到相应设置，删除。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.atongmu.cn/?feed=rss2&amp;p=6335</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu 9.04安装文泉驿微米黑字体</title>
		<link>http://www.atongmu.cn/?p=6331</link>
		<comments>http://www.atongmu.cn/?p=6331#comments</comments>
		<pubDate>Sun, 02 May 2010 01:01:17 +0000</pubDate>
		<dc:creator>噪音有害健康</dc:creator>
		
		<category><![CDATA[技术片段]]></category>

		<category><![CDATA[9.04]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[ubuntu]]></category>

		<category><![CDATA[Unix]]></category>

		<category><![CDATA[字体]]></category>

		<category><![CDATA[安装字体]]></category>

		<category><![CDATA[文泉驿]]></category>

		<category><![CDATA[文泉驿微米黑]]></category>

		<category><![CDATA[简体中文]]></category>

		<category><![CDATA[繁体中文]]></category>

		<guid isPermaLink="false">http://www.atongmu.cn/?p=6331</guid>
		<description><![CDATA[文泉驿微米黑字体在Ubuntu下的显示效果非常不错，我前几日重新安装了Ubuntu 9.04版本，在该版本下，尝试使用文泉驿微米黑字体]]></description>
			<content:encoded><![CDATA[<p>文泉驿微米黑是一个”自由字体”。该字体包含了所有常用简体中文、繁体中文所需要的汉字(最新版本包含超过20932个汉字，完整覆盖 GB2312/Big5以及GBK标准字符集)。该字体同时还包含了日文、韩文和其他几十种语言符号。以外，该字体还包含了高质量的Droid Sans拉丁符号和Droid Sans Mono等宽字体，并内置Hinting和Kerning信息。微米黑字体文件极小，特别使用于便携式电脑设备。从文泉驿正黑开始使用，到现在发布的文泉驿微米黑字体，可以说是上了一个新的台阶，文泉驿微米黑字体在Ubuntu下的显示效果非常不错，我前几日重新安装了Ubuntu 9.04版本，在该版本下，尝试使用文泉驿微米黑字体。</p>
<p>Ubuntu 9.04安装文泉驿微米黑字体同较早发布的Ubuntu版本安装字体一致，具体步骤如下：</p>
<p>1、下载文泉驿微米黑字体，去文泉驿官方网站查找，或者从如下链接下载：<br />
<code>https://sourceforge.net/project/downloading.php?group_id=128192&#038;filename=wqy-microhei-0.2.0-beta.tar.gz&#038;a=95328517</code></p>
<p>2、将下载的文泉驿微米黑字体解压至你能够找到的地方，以管理员身份打开字体文件夹。<br />
<code>/usr/share/fonts</code></p>
<p>3、在fonts文件夹内新建一个文件夹，用于放置文泉驿微米黑字体，比如我新建了一个名为mihei的文件夹，将微米黑字体复制粘贴至该文件夹内。<br />
<code>sudo mkdir mihei<br />
sudo cp /home/../wqy-microhei.ttc /usr/share/fonts/mihei/<br />
</code></p>
<p>4、修改字体权限，确保非root帐户亦能使用该字体。<br />
<code>sudo chmod 555 /usr/share/fonts/mihei/*</code></p>
<p>5、建立字体缓存。<br />
<code>cd /usr/share/fonts/mihei/<br />
sudo mkfontscale<br />
sudo mkfontdir<br />
sudo fc-cache -fv<br />
</code></p>
<p>6、修改系统字体。</p>
<p>重启电脑，你就可以看到文泉驿微米黑的完美显示效果了，不过值得一提的是：</p>
<p>1、必须修改终端字体设置，否则终端内英文字体会挤在一堆，相当难看。打开终端－编辑－配置文件手选项，在配置文件手选项“常规”选项卡中，去掉“使用系统的等宽字体”前面的勾，在“字体”中选择“文泉驿等宽微米黑”。</p>
<p>2、在Firefox下，网页字体较小，浏览网页时有点不爽，可以增大Firefox字体，将默认16号字体改为17号，显示效果更佳。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.atongmu.cn/?feed=rss2&amp;p=6331</wfw:commentRss>
		</item>
		<item>
		<title>UBUNTU系统中如何让Opera和amule关联</title>
		<link>http://www.atongmu.cn/?p=6329</link>
		<comments>http://www.atongmu.cn/?p=6329#comments</comments>
		<pubDate>Sat, 01 May 2010 09:34:53 +0000</pubDate>
		<dc:creator>噪音有害健康</dc:creator>
		
		<category><![CDATA[技术片段]]></category>

		<category><![CDATA[8.10]]></category>

		<category><![CDATA[9.04]]></category>

		<category><![CDATA[amule]]></category>

		<category><![CDATA[ed2k]]></category>

		<category><![CDATA[Opera]]></category>

		<category><![CDATA[ubuntu]]></category>

		<category><![CDATA[下载]]></category>

		<category><![CDATA[关联]]></category>

		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.atongmu.cn/?p=6329</guid>
		<description><![CDATA[在ubuntu系统上使用opera的朋友，希望直接点击ed2k链接就可以直接把链接送到amule去下载，现在说说如何实现这个问题，让Opera和amule关联]]></description>
			<content:encoded><![CDATA[<p>在ubuntu系统上使用opera的朋友，希望直接点击ed2k链接就可以直接把链接送到amule去下载，现在说说如何实现这个问题，让Opera和amule关联。</p>
<p>如果是UBUNTU中文系统，按如下操作：<br />
<code><br />
opera 中“工具”->“首选项”->“高级”->“程序”中添加协议： ed2k, 使用程序 /usr/bin/ed2k 打开。<br />
然后，把“工具”->“首选项”->“高级”->“网络”中，将“用UTF-8 给国际语言网址编码“这个checkbox的勾去掉即可。<br />
</code><br />
否则，无法下载包含中文字符的文件。</p>
<p>如果是UBUNTU英文系统，按如下操作：<br />
<code><br />
opera 中“Tools”->“Preferences”->“Advanced”->“Programs”中添加协议： ed2k, 使用程序 /usr/bin/ed2k 打开。<br />
然后，把“Tools”->“Preferences”->“Advanced”->“Network”中，将“Encode international Web address with UTF-8“这个checkbox的勾去掉即可。<br />
</code></p>
<p>相关链接</p>
]]></content:encoded>
			<wfw:commentRss>http://www.atongmu.cn/?feed=rss2&amp;p=6329</wfw:commentRss>
		</item>
	</channel>
</rss>
