99久久www免费,中文一区在线播放,成人自拍网站http://www.aygfsteel.com/stephen80/category/5942.html軟件架構(gòu),saas,戰(zhàn)略管理zh-cnTue, 05 Jan 2010 06:07:23 GMTTue, 05 Jan 2010 06:07:23 GMT60mysql best practicehttp://www.aygfsteel.com/stephen80/archive/2010/01/05/308270.html西津渡西津渡Tue, 05 Jan 2010 05:38:00 GMThttp://www.aygfsteel.com/stephen80/archive/2010/01/05/308270.htmlhttp://www.aygfsteel.com/stephen80/comments/308270.htmlhttp://www.aygfsteel.com/stephen80/archive/2010/01/05/308270.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/308270.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/308270.html

Myisam is preferred without transaction and little update(delete)

Big than 4G datafile can user Myisam merge table.

InnoDB with auto_increment primary key is preferred.

Few storage process

Guess: 20m records max per table , 500G data max per tablespace , 256 tables per database (may problem)

Use prepared statement and  batch

Optimize Your Queries For the Query Cache

// query cache does NOT work
$r = mysql_query("SELECT username FROM user WHERE signup_date >= CURDATE()");
 
// query cache works!
$today = date("Y-m-d");
$r = mysql_query("SELECT username FROM user WHERE signup_date >= '$today'");

EXPLAIN Your SELECT Queries

LIMIT 1 When Getting a Unique Row

Index and Use Same Column Types for Joins

Do Not ORDER BY RAND()

Avoid SELECT *

t is a good habit to always specify which columns you need when you are doing your SELECT’s.

Use ENUM over VARCHAR

Use NOT NULL If You Can

Store IP Addresses as UNSIGNED INT (?)

Fixed-length (Static) Tables are Faster

Vertical Partitioning

Vertical Partitioning is the act of splitting your table structure in a vertical manner for optimization reasons.

Example 1: You might have a users table that contains home addresses, that do not get read often. You can choose to split your table and store the address info on a separate table. This way your main users table will shrink in size. As you know, smaller tables perform faster.

Example 2: You have a “last_login” field in your table. It updates every time a user logs in to the website. But every update on a table causes the query cache for that table to be flushed. You can put that field into another table to keep updates to your users table to a minimum.

But you also need to make sure you don’t constantly need to join these 2 tables after the partitioning or you might actually suffer performance decline.

Split the Big DELETE or INSERT Queries

If you have some kind of maintenance script that needs to delete large numbers of rows, just use the LIMIT clause to do it in smaller batches to avoid this congestion.

Smaller Columns Are Faster

Use an Object Relational Mapper

f you do not need the time component, use DATE instead of DATETIME.

Consider horizontally spitting many-columned tables if they contain a lot of NULLs or rarely used columns.

Be an SQL programmer who thinks in sets, not procedural programming paradigms

InnoDB can’t optimize SELECT COUNT(*) queries. Use counter tables! That’s how to scale InnoDB.

Prefer MM with hive

refer :

http://blog.tuvinh.com/top-20-mysql-best-practices/



西津渡 2010-01-05 13:38 發(fā)表評(píng)論
]]>
mysql jdbc driver code browserhttp://www.aygfsteel.com/stephen80/archive/2009/12/30/307741.html西津渡西津渡Wed, 30 Dec 2009 04:41:00 GMThttp://www.aygfsteel.com/stephen80/archive/2009/12/30/307741.htmlhttp://www.aygfsteel.com/stephen80/comments/307741.htmlhttp://www.aygfsteel.com/stephen80/archive/2009/12/30/307741.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/307741.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/307741.html 從時(shí)序圖中可以看到,createNewIO()就是新建了一個(gè)com.mysql.jdbc.MysqlIO,利用 com.mysql.jdbc.StandardSocketFactory來(lái)創(chuàng)建一個(gè)socket。然后就由這個(gè)mySqlIO來(lái)與MySql服務(wù)器進(jìn)行握手(doHandshake()),這個(gè)doHandshake主要用來(lái)初始化與Mysql server的連接,負(fù)責(zé)登陸服務(wù)器和處理連接錯(cuò)誤。在其中會(huì)分析所連接的mysql server的版本,根據(jù)不同的版本以及是否使用SSL加密數(shù)據(jù)都有不同的處理方式,并把要傳輸給數(shù)據(jù)庫(kù)server的數(shù)據(jù)都放在一個(gè)叫做packet的 buffer中,調(diào)用send()方法往outputStream中寫(xiě)入要發(fā)送的數(shù)據(jù)。


useServerPreparedStmts置為true的話(huà),mysql驅(qū)動(dòng)可以通過(guò)PreparedStatement的子類(lèi)ServerPreparedStatement來(lái)實(shí)現(xiàn)真正的PreparedStatement的功能




第一位表示數(shù)據(jù)包的開(kāi)始位置,就是數(shù)據(jù)存放的起始位置,一般都設(shè)置為0,就是從第一個(gè)位置開(kāi)始。第二和第三個(gè)字節(jié)標(biāo)識(shí)了這個(gè)數(shù)據(jù)包的大小,注意的是,這個(gè)大小是出去標(biāo)識(shí)的4個(gè)字節(jié)的大小,對(duì)于非最后一個(gè)數(shù)據(jù)包來(lái)說(shuō),這個(gè)大小都是一樣的,就是splitSize,也就是maxThreeBytes,它的值是 255 * 255 * 255。
最后一個(gè)字節(jié)中存放的就是數(shù)據(jù)包的編號(hào)了,從0開(kāi)始遞增。
在標(biāo)識(shí)位設(shè)置完畢之后,就可以把255 * 255 * 255大小的數(shù)據(jù)從我們準(zhǔn)備好的待發(fā)送數(shù)據(jù)包中copy出來(lái)了,注意,前4位已經(jīng)是標(biāo)識(shí)位了,所以應(yīng)該從第五個(gè)位置開(kāi)始copy數(shù)據(jù)

 # packetToSend = compressPacket(headerPacket, HEADER_LENGTH,    
#                 splitSize, HEADER_LENGTH); 

LoadBalancingConnectionProxy
package java.lang.reflect 。 proxy .


http://developer.51cto.com/art/200907/137823.htm

http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-implementation-notes.html

PreparedStatements are implemented by the driver, as MySQL does not have a prepared statement feature. Because of this, the driver does not implement getParameterMetaData() or getMetaData() as it would require the driver to have a complete SQL parser in the client.

Starting with version 3.1.0 MySQL Connector/J, server-side prepared statements and binary-encoded result sets are used when the server supports them.


但這是不是說(shuō)PreparedStatement沒(méi)用呢?不是的,PreparedStatement有其他的好處:
1.代碼的可讀性和可維護(hù)性
2.最重要的一點(diǎn)是極大地提高了安全性,可以防止SQL注入

然后我又看了一些網(wǎng)上其他人的經(jīng)驗(yàn),基本和我的判斷一致,有兩點(diǎn)要特別提請(qǐng)大家注意:

1.并不是說(shuō)PreparedStatement在所有的DB上都不會(huì)提高效率,PreparedStatement需要服務(wù)器端的支持,比如在 Oracle上就會(huì)有顯著效果。上面說(shuō)的測(cè)試都是在MySQL上測(cè)試的,我找到了一個(gè)MySQL架構(gòu)師的帖子,比較明確地說(shuō)明了MySQL不支持 PreparedStatement。

2.即便PreparedStatement不能提高性能,在少數(shù)使用時(shí)甚至?xí)档托剩匀粦?yīng)該使用PreparedStatement!因?yàn)槠渌? 處實(shí)在是太大了!當(dāng)然,當(dāng)SQL查詢(xún)比較復(fù)雜時(shí),可能PreparedStatement好處會(huì)更大,只是我沒(méi)有測(cè)試,不敢肯定。

3.既然PreparedStatement不能提高效率,那PreparedStatement Pool也就沒(méi)有必要了。但可以看到每次新建Connection的開(kāi)銷(xiāo)實(shí)在很大,因此Connection Pool絕對(duì)必要。





西津渡 2009-12-30 12:41 發(fā)表評(píng)論
]]>
java post mortem diagnoshttp://www.aygfsteel.com/stephen80/archive/2009/12/07/304998.html西津渡西津渡Mon, 07 Dec 2009 06:16:00 GMThttp://www.aygfsteel.com/stephen80/archive/2009/12/07/304998.htmlhttp://www.aygfsteel.com/stephen80/comments/304998.htmlhttp://www.aygfsteel.com/stephen80/archive/2009/12/07/304998.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/304998.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/304998.html jstat -gcutil 16761
jmap -finalizerinfo 16761
jmap -histo 16761
jstack -l 16761
jinfo 16761

Examine the fatal error log file. Default file name is hs_err_pidpid.log in the working-directory.

-XX:+HeapDumpOnOutOfMemoryError
java -agentlib:hprof=heap=dump,format=b application
$ jmap -dump:format=b,file=snapshot.jmap process-pid

1、在jvm啟動(dòng)時(shí)加上:-agentlib:hprof=heap=sites,file=heap.txt  ,然后執(zhí)行一段時(shí)間后執(zhí)行 kill -3 <pid>,就可以獲取jvm的內(nèi)存鏡像。類(lèi)似的通過(guò)-agentlib:hprof=cpu=samples,file=cpu.txt查 看cpu的狀況。

http://java.sun.com/javase/6/webnotes/trouble/other/matrix6-Unix.html


Quick Troubleshooting Tips on Solaris OS and Linux for Java SE 6

This "Quick Start Guide" gives you some quick tips for troubleshooting. The subsections list some typical functions that can help you in troubleshooting, including one or more ways to get the information or perform the action.

These tips are organized as follows:

Hung, Deadlocked, or Looping Process
Post-mortem Diagnostics, Memory Leaks
Monitoring
Actions on a Remote Debug Server
Other Functions

Hung, Deadlocked, or Looping Process

  • Print thread stack for all Java threads:
    • Control-"
    • kill -QUIT pid
    • jstack pid (or jstack -F pid if jstack pid does not respond)
  • Detect deadlocks:
    • Request deadlock detection: JConsole tool, Threads tab
    • Print information on deadlocked threads: Control-"
    • Print list of concurrent locks owned by each thread: -XX:+PrintConcurrentLocks set, then Control-"
    • Print lock information for a process: jstack -l pid
  • Get a heap histogram for a process:
    • Start Java process with -XX:+PrintClassHistogram, then Control-"
    • jmap -histo pid (with -F option if pid does not respond)
  • Dump Java heap for a process in binary format to file:
    • jmap -dump:format=b,file=filename pid (with -F option if pid does not respond)
  • Print shared object mappings for a process:
    • jmap pid
  • Print heap summary for a process:
    • Control-"
    • jmap -heap pid
  • Print finalization information for a process:
    • jmap -finalizerinfo pid
  • Attach the command-line debugger to a process:
    • jdb -connect sun.jvm.hotspot.jdi.SAPIDAttachingConnector:pid=pid

Post-mortem Diagnostics, Memory Leaks

  • Examine the fatal error log file. Default file name is hs_err_pidpid.log in the working-directory.
  • Create a heap dump:
    • Start the application with HPROF enabled: java -agentlib:hprof=file=file,format=b application; then Control-"
    • Start the application with HPROF enabled: java -agentlib:hprof=heap=dump application
    • JConsole tool, MBeans tab
    • Start VM with -XX:+HeapDumpOnOutOfMemoryError; if OutOfMemoryError is thrown, VM generates a heap dump.
  • Browse Java heap dump:
    • jhat heap-dump-file
  • Dump Java heap from core file in binary format to a file:
    • jmap -dump:format=b,file=filename corefile
  • Get a heap histogram for a process:
    • Start Java process with -XX:+PrintClassHistogram, then Control-"
    • jmap -histo pid (with -F option if pid does not respond)
  • Get a heap histogram from a core file:
    • jmap -histo corefile
  • Print shared object mappings from a core file:
    • jmap corefile
  • Print heap summary from a core file:
    • jmap -heap corefile
  • Print finalization information from a core file:
    • jmap -finalizerinfo corefile
  • Print Java configuration information from a core file:
    • jinfo corefile
  • Print thread trace from a core file:
    • jstack corefile
  • Print lock information from a core file:
    • jstack -l corefile
  • Attach the command-line debugger to a core file on the same machine:
    • jdb -connect sun.jvm.hotspot.jdi.SACoreAttachingConnector:javaExecutable=path,core=corefile
  • Attach the command-line debugger to a core file on a different machine:
    • On the machine with the core file: jsadebugd path corefile
      and on the machine with the debugger: jdb -connect sun.jvm.hotspot.jdi.SADebugServerAttachingConnector:debugServerName=machine
  • libumem can be used to debug memory leaks.

Monitoring

Note: The vmID argument for the jstat command is the virtual machine identifier. See the jstat man page for a detailed explanation.

  • Print statistics on the class loader:
    • jstat -class vmID
  • Print statistics on the compiler:
    • Compiler behavior: jstat -compiler vmID
    • Compilation method statistics: jstat -printcompilation vmID
  • Print statistics on garbage collection:
    • Summary of statistics: jstat -gcutil vmID
    • Summary of statistics, with causes: jstat -gccause vmID
    • Behavior of the gc heap: jstat -gc vmID
    • Capacities of all the generations: jstat -gccapacity vmID
    • Behavior of the new generation: jstat -gcnew vmID
    • Capacity of the new generation: jstat -gcnewcapacity vmID
    • Behavior of the old and permanent generations: jstat -gcold vmID
    • Capacity of the old generation: jstat -gcoldcapacity vmID
    • Capacity of the permanent generation: jstat -gcpermcapacity vmID
  • Monitor objects awaiting finalization:
    • JConsole tool, VM Summary tab
    • jmap -finalizerinfo pid
    • getObjectPendingFinalizationCount method in java.lang.management.MemoryMXBean class
  • Monitor memory:
    • Heap allocation profiles via HPROF: java -agentlib:hprof=heap=sites
    • JConsole tool, Memory tab
    • Control-" prints generation information.
  • Monitor CPU usage:
    • By thread stack: java -agentlib:hprof=cpu=samples application
    • By method: java -agentlib:hprof=cpu=times application
    • JConsole tool, Overview and VM Summary tabs
  • Monitor thread activity:
    • JConsole tool, Threads tab
  • Monitor class activity:
    • JConsole tool, Classes tab

Actions on a Remote Debug Server

First, attach the debug daemon jsadebugd, then execute the command:

  • Dump Java heap in binary format to a file: jmap -dump:format=b,file=filename hostID
  • Print shared object mappings: jmap hostID
  • Print heap summary : jmap -heap hostID
  • Print finalization information : jmap -finalizerinfo hostID
  • Print lock information : jstack -l hostID
  • Print thread trace : jstack hostID
  • Print Java configuration information: jinfo hostID

Other Functions

  • Interface with the instrumented Java virtual machines:
    • Monitor for the creation and termination of instrumented VMs: jstatd daemon
    • List the instrumented VMs: jps
    • Provide interface between remote monitoring tools and local VMs: jstatd daemon
    • Request garbage collection: JConsole tool, Memory tab
  • Print Java configuration information from a running process:
    • jinfo pid
  • Dynamically set, unset, or change the value of certain Java VM flags for a process:
    • jinfo -flag flag
  • Print command-line flags passed to the VM:
    • jinfo -flags
  • Print Java system properties:
    • jinfo -sysprops
  • Pass a Java VM flag to the virtual machine:
    • jconsole -Jflag ...
    • jhat -Jflag ...
    • jmap -Jflag ...
  • Print statistics of permanent generation of Java heap, by class loader:
    • jmap -permstat
  • Report on monitor contention.
    • java -agentlib:hprof=monitor=y application
  • Evaluate or execute a script in interactive or batch mode:
    • jrunscript
  • Interface dynamically with an MBean, via JConsole tool, MBean tab:
    • Show tree structure.
    • Set an attribute value.
    • Invoke an operation.
    • Subscribe to notification.
  • Run interactive command-line debugger:
    • Launch a new VM for the class: jdb class
    • Attach debugger to a running VM: jdb -attach address
    http://www.aygfsteel.com/justinchen/archive/2009/01/08/248738.html


西津渡 2009-12-07 14:16 發(fā)表評(píng)論
]]>
java performance http://www.aygfsteel.com/stephen80/archive/2009/07/22/287892.html西津渡西津渡Wed, 22 Jul 2009 10:07:00 GMThttp://www.aygfsteel.com/stephen80/archive/2009/07/22/287892.htmlhttp://www.aygfsteel.com/stephen80/comments/287892.htmlhttp://www.aygfsteel.com/stephen80/archive/2009/07/22/287892.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/287892.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/287892.html
1. first think algorithm before concurrent
2. first solve top problem
3. memory can be problem with huge data processing
4.  not to use refletion frequently
5. prefering strategy that can optimize both cpu and memory .

technical
1. thread synchronizing is how to queuing
   be sure to use "while(!Thread.currentThread.isInterupted())

2. prefer high level  synchronizing facility to low level methodology such as await,notify

3. dedicated sorter is much faster


 










西津渡 2009-07-22 18:07 發(fā)表評(píng)論
]]>
幾個(gè)性能的注意點(diǎn)http://www.aygfsteel.com/stephen80/archive/2007/09/26/148247.html西津渡西津渡Wed, 26 Sep 2007 02:59:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/09/26/148247.htmlhttp://www.aygfsteel.com/stephen80/comments/148247.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/09/26/148247.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/148247.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/148247.html http://www.xker.com/edu/dev/104/0652109570034579.html

十二、不要在循環(huán)中調(diào)用synchronized(同步)方法


方法的同步需要消耗相當(dāng)大的資料,在一個(gè)循環(huán)中調(diào)用它絕對(duì)不是一個(gè)好主意。

例子:
import java.util.Vector;
public class SYN {
    public synchronized void method (Object o) {
    }
    private void test () {
        for (int i = 0; i < vector.size(); i++) {
            method (vector.elementAt(i));    // violation
        }
    }
    private Vector vector = new Vector (5, 5);
}

更正:
不要在循環(huán)體中調(diào)用同步方法,如果必須同步的話(huà),推薦以下方式:
import java.util.Vector;
public class SYN {
    public void method (Object o) {
    }
private void test () {
    synchronized{//在一個(gè)同步塊中執(zhí)行非同步方法
            for (int i = 0; i < vector.size(); i++) {
                method (vector.elementAt(i));   
            }
        }
    }
    private Vector vector = new Vector (5, 5);
}


十三、將try/catch塊移出循環(huán)


把try/catch塊放入循環(huán)體內(nèi),會(huì)極大的影響性能,如果編譯JIT被關(guān)閉或者你所使用的是一個(gè)不帶JIT的JVM,性能會(huì)將下降21%之多!
         
例子:         
import java.io.FileInputStream;
public class TRY {
    void method (FileInputStream fis) {
        for (int i = 0; i < size; i++) {
            try {                                      // violation
                _sum += fis.read();
            } catch (Exception e) {}
        }
    }
    private int _sum;
}
         
更正:         
將try/catch塊移出循環(huán)         
    void method (FileInputStream fis) {
        try {
            for (int i = 0; i < size; i++) {
                _sum += fis.read();
            }
        } catch (Exception e) {}
    }
         
參考資料:
Peter Haggar: "Practical Java - Programming Language Guide".
Addison Wesley, 2000, pp.81 – 83


十九、不要在循環(huán)體中實(shí)例化變量


在循環(huán)體中實(shí)例化臨時(shí)變量將會(huì)增加內(nèi)存消耗

例子:         
import java.util.Vector;
public class LOOP {
    void method (Vector v) {
        for (int i=0;i < v.size();i++) {
            Object o = new Object();
            o = v.elementAt(i);
        }
    }
}
         
更正:         
在循環(huán)體外定義變量,并反復(fù)使用         
import java.util.Vector;
public class LOOP {
    void method (Vector v) {
        Object o;
        for (int i=0;i<v.size();i++) {
            o = v.elementAt(i);
        }
    }
}

二十一、盡可能的使用棧變量


如果一個(gè)變量需要經(jīng)常訪(fǎng)問(wèn),那么你就需要考慮這個(gè)變量的作用域了。static? local?還是實(shí)例變量?訪(fǎng)問(wèn)靜態(tài)變量和實(shí)例變量將會(huì)比訪(fǎng)問(wèn)局部變量多耗費(fèi)2-3個(gè)時(shí)鐘周期。
         
例子:
public class USV {
    void getSum (int[] values) {
        for (int i=0; i < value.length; i++) {
            _sum += value[i];           // violation.
        }
    }
    void getSum2 (int[] values) {
        for (int i=0; i < value.length; i++) {
            _staticSum += value[i];
        }
    }
    private int _sum;
    private static int _staticSum;
}     
         
更正:         
如果可能,請(qǐng)使用局部變量作為你經(jīng)常訪(fǎng)問(wèn)的變量。
你可以按下面的方法來(lái)修改getSum()方法:         
void getSum (int[] values) {
    int sum = _sum;  // temporary local variable.
    for (int i=0; i < value.length; i++) {
        sum += value[i];
    }
    _sum = sum;
}
         
參考資料:         
Peter Haggar: "Practical Java - Programming Language Guide".
Addison Wesley, 2000, pp.122 – 125





西津渡 2007-09-26 10:59 發(fā)表評(píng)論
]]>
大量字符串操作中的性能問(wèn)題http://www.aygfsteel.com/stephen80/archive/2007/09/26/148224.html西津渡西津渡Wed, 26 Sep 2007 02:14:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/09/26/148224.htmlhttp://www.aygfsteel.com/stephen80/comments/148224.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/09/26/148224.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/148224.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/148224.html
1). 簡(jiǎn)單的認(rèn)為 .append() 效率好于 "+" 是錯(cuò)誤的!
    2). 不要使用 new 創(chuàng)建 String
    3). 注意 .intern() 的使用
    4). 在編譯期能夠確定字符串值的情況下,使用"+"效率最高
    5). 避免使用 "+=" 來(lái)構(gòu)造字符串
    6). 在聲明StringBuffer對(duì)象的時(shí)候,指定合適的capacity,不要使用默認(rèn)值(18)
    7). 注意以下二者的區(qū)別不一樣
        - String s = "a" + "b";
        - String s = "a";
          s += "b";

關(guān)鍵點(diǎn)
1. 無(wú)論何時(shí)只要可能的話(huà)使用字符串字面量來(lái)常見(jiàn)字符串而不是使用new關(guān)鍵字來(lái)創(chuàng)建字符串。
2. 無(wú)論何時(shí)當(dāng)你要使用new關(guān)鍵字來(lái)創(chuàng)建很多內(nèi)容重復(fù)的字符串的話(huà),請(qǐng)使用String.intern()方法。
3. +操作符會(huì)為字符串連接提供最佳的性能――當(dāng)字符串是在編譯期決定的時(shí)候。
4. 如果字符串在運(yùn)行期決定,使用一個(gè)合適的初期容量值初始化的StringBuffer會(huì)為字符串連接提供最佳的性能。



西津渡 2007-09-26 10:14 發(fā)表評(píng)論
]]>
重歸簡(jiǎn)約http://www.aygfsteel.com/stephen80/archive/2007/09/14/145158.html西津渡西津渡Fri, 14 Sep 2007 07:52:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/09/14/145158.htmlhttp://www.aygfsteel.com/stephen80/comments/145158.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/09/14/145158.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/145158.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/145158.html

castor, dwr, acegi, 幾乎扔掉。

spring ,hibernate 也只用在適當(dāng)?shù)膱?chǎng)合。

struts2 ,也只用在適當(dāng)?shù)膱?chǎng)合。


一些偷懶的技術(shù),盡量避免。
opensession in view.



西津渡 2007-09-14 15:52 發(fā)表評(píng)論
]]>
重新評(píng)估 solrhttp://www.aygfsteel.com/stephen80/archive/2007/09/07/143491.html西津渡西津渡Fri, 07 Sep 2007 09:18:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/09/07/143491.htmlhttp://www.aygfsteel.com/stephen80/comments/143491.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/09/07/143491.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/143491.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/143491.html一直困擾于 indexSearcher 的重新 new ,query filter 的cache 沒(méi)了。 重讀solr ,發(fā)現(xiàn)非常好。也許我應(yīng)該考慮用 solr 了。


Caching

  • Configurable Query Result, Filter, and Document cache instances
  • Pluggable Cache implementations
  • Cache warming in background
    • When a new searcher is opened, configurable searches are run against it in order to warm it up to avoid slow first hits. During warming, the current searcher handles live requests.
  • Autowarming in background
    • The most recently accessed items in the caches of the current searcher are re-populated in the new searcher, enabing high cache hit rates across index/searcher changes.
  • Fast/small filter implementation
  • User level caching with autowarming support
9-26
  今天,我發(fā)現(xiàn),我可以用不同的方式實(shí)現(xiàn)cache ,也許在我的情況下比solr 的方式更好。


西津渡 2007-09-07 17:18 發(fā)表評(píng)論
]]>
關(guān)于j2ee 性能的一個(gè)課題http://www.aygfsteel.com/stephen80/archive/2007/09/06/143275.html西津渡西津渡Thu, 06 Sep 2007 12:55:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/09/06/143275.htmlhttp://www.aygfsteel.com/stephen80/comments/143275.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/09/06/143275.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/143275.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/143275.html 開(kāi)源軟件,用什么樣的 proxy, cache, web container 達(dá)到最好的性能。

瓶頸在于:
 tomcat 只能用到2g ram

經(jīng)過(guò)研究,
xmx 在windows 2003,jdk1.5.06 ,1999M.
所以如果是一臺(tái)單純的web container server 就不要搞8G了, 1U 的4G ok.

需要用到那么高的性能場(chǎng)景,只能是兩臺(tái)1U做 banlance.

再次研究
用 session stick ,balance 2 個(gè) tomcat ,應(yīng)該可以達(dá)到較好的性能。



西津渡 2007-09-06 20:55 發(fā)表評(píng)論
]]>
c3p0 ,hibernate 配置,springhttp://www.aygfsteel.com/stephen80/archive/2007/09/06/143150.html西津渡西津渡Thu, 06 Sep 2007 05:16:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/09/06/143150.htmlhttp://www.aygfsteel.com/stephen80/comments/143150.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/09/06/143150.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/143150.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/143150.html

spring+hibernate
   
連接池

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
  
    
     <property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/openfire"/>
<property name="user" value="root"/>
<property name="password" value="password"/>
   
    </bean>
   
   
</beans>

tomcat jndi:

<Resource auth="Container" description="DB Connection" driverClass="com.mysql.jdbc.Driver" maxPoolSize="4" minPoolSize="2" acquireIncrement="1" name="jdbc/TestDB" user="test" password="ready2go" factory="org.apache.naming.factory.BeanFactory" type="com.mchange.v2.c3p0.ComboPooledDataSource" jdbcUrl="jdbc:mysql://localhost:3306/test?autoReconnect=true" />






建議:c3p0.propertyies

c3p0.acquireIncrement=5       
c3p0.idleConnectionTestPeriod=1800   
c3p0.initialPoolSize=5       
c3p0.maxIdleTime=1000
c3p0.maxPoolSize=20   
c3p0.maxStatements=100   
c3p0.minPoolSize=5


just hibernate:
hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider


調(diào)優(yōu):在我的環(huán)境下
maxpoolSize 30, 1822 , 15, 1655 。 可能和測(cè)試過(guò)程有關(guān)。
maxStatement 加上, 3600。嚴(yán)重影響性能。

擴(kuò)大 xms xmx 512 ,957




西津渡 2007-09-06 13:16 發(fā)表評(píng)論
]]>
tree ,hibernate, db hierarchical http://www.aygfsteel.com/stephen80/archive/2007/09/05/142887.html西津渡西津渡Wed, 05 Sep 2007 06:18:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/09/05/142887.htmlhttp://www.aygfsteel.com/stephen80/comments/142887.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/09/05/142887.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/142887.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/142887.html
有些操作,在db 中更好。

1。取得所有的葉子節(jié)點(diǎn)。

SELECT Name FROM Projects p WHERE NOT EXISTS( SELECT * FROM Projects WHERE Parent=p.VertexId)

2。multilevel operation ,用數(shù)據(jù)庫(kù)的輔助表, 用triger 。
CREATE TABLE ProjectPaths(

VertexId INTEGER,

Depth INTEGER,

Path VARCHAR(300) 。



)
3. 用 hibernate 時(shí),如果 stack over flow,考慮用 stack 代替recursive algrithm

public void traverseDepthFirst( AST ast )
{
// Root AST node cannot be null or
// traversal of its subtree is impossible.
if ( ast == null )
{
throw new IllegalArgumentException(
"node to traverse cannot be null!" );
}
// Map to hold parents of each
// AST node. Unfortunately the AST
// interface does not provide a method
// for finding the parent of a node, so
// we use the Map to save them.

Map parentNodes = new HashMap();

// Start tree traversal with first child
// of the specified root AST node.

AST currentNode = ast.getFirstChild();

// Remember parent of first child.

parentNodes.put( currentNode , ast );

// Iterate through nodes, simulating
// recursive tree traversal, and add them
// to queue in proper order for later
// linear traversal. This "flattens" the
// into a linear list of nodes which can
// be visited non-recursively.

while ( currentNode != null )
{
// Visit the current node.

strategy.visit( currentNode );

// Move down to current node's first child
// if it exists.

AST childNode = currentNode.getFirstChild();

// If the child is not null, make it
// the current node.

if ( childNode != null )
{
// Remember parent of the child.

parentNodes.put( childNode , currentNode );

// Make child the current node.

currentNode = childNode;

continue;
}

while ( currentNode != null )
{
// Move to next sibling if any.

AST siblingNode = currentNode.getNextSibling();

if ( siblingNode != null )
{
// Get current node's parent.
// This is also the parent of the
// sibling node.

AST parentNode = (AST)parentNodes.get( currentNode );

// Remember parent of sibling.

parentNodes.put( siblingNode , parentNode );

// Make sibling the current node.

currentNode = siblingNode;

break;
}
// Move up to parent if no sibling.
// If parent is root node, we're done.

currentNode = (AST)parentNodes.get( currentNode );

if ( currentNode.equals( ast ) )
{
currentNode = null;
}
}
}




參考:

http://wordhoard.northwestern.edu/userman/hibernatechanges.html

《Tansact Sql cookbook.》








西津渡 2007-09-05 14:18 發(fā)表評(píng)論
]]>
hibernate 的幾個(gè)注意點(diǎn)http://www.aygfsteel.com/stephen80/archive/2007/09/05/142860.html西津渡西津渡Wed, 05 Sep 2007 04:11:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/09/05/142860.htmlhttp://www.aygfsteel.com/stephen80/comments/142860.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/09/05/142860.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/142860.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/142860.html
private List _items;

<bag
name="items"
inverse="true"   //盡量使用雙向關(guān)聯(lián)
order-by="DATE_TIME"
cascade="all">
<key column="BLOG_ID"/>
<one-to-many class="BlogItem"/>
</bag>


many-to-many ,建議用 set



二、one-to-one 適用
            通過(guò)主鍵進(jìn)行關(guān)聯(lián)
            相當(dāng)于把大表拆分為多個(gè)小表
            例如把大字段單獨(dú)拆分出來(lái),以提高數(shù)據(jù)庫(kù)操作的性能

三、composite element ,必須依賴(lài)的導(dǎo)航關(guān)系

 <list name="lineItems" table="line_items">
<key column="order_id"/>
<list-index column="line_number"/>
<composite-element class="LineItem">
<property name="quantity"/>
<many-to-one name="product" column="product_id"/>
</composite-element>
</list>

四、 one-one formula , 很復(fù)雜,有點(diǎn)不明白

 <class name="Person">
<id name="name"/>
<one-to-one name="address"
cascade="all">
<formula>name</formula>
<formula>'HOME'</formula>
</one-to-one>
<one-to-one name="mailingAddress"
cascade="all">
<formula>name</formula>
<formula>'MAILING'</formula>
</one-to-one>
</class>
<class name="Address" batch-size="2"
check="addressType in ('MAILING', 'HOME', 'BUSINESS')">
<composite-id>
<key-many-to-one name="person"
column="personName"/>
<key-property name="type"
column="addressType"/>
</composite-id>
<property name="street" type="text"/>
<property name="state"/>
<property name="zip"/>
</class>


五、繼承關(guān)系, per subclass table ,no discriminator ,joined-subclass




六、tree
拷貝: http://www.thogau.net/tutorials/tree/tutorial02-01.jsp


package net.thogau.website.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * This class implements a persisted tree node.
 *
 * @author <a href="mailto:thogau@thogau.net">thogau</a>
 *
 * @struts.form include-all="false" extends="BaseForm"
 * @hibernate.class table="node"
 */
public class Node extends BaseObject implements Serializable {
   
    // mapped to primary key in node table
    protected Long id;
       
    protected String name;
   
    protected Node parent = null;
   
    protected List children = new ArrayList();
   
    /**
     * @hibernate.id column="id" generator-class="native" unsaved-value="null"
     * @struts.form-field
     */
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }   
   
    /**
     * Returns the node name.
     *
     * @return String
     *
     * @hibernate.property column="name" not-null="true" unique="true"
     * @struts.form-field
     * @struts.validator type="required"
     *
     */
    public String getName() {
        return name;
    }  
    public void setName(String name) {
        this.name = name;
    }
   
    /**
     * Returns the node's children.
     *
     * @return List
     *
     * @hibernate.list cascade="all-delete-orphan" inverse="true"
     * @hibernate.collection-one-to-many class="net.thogau.website.model.Node"
     * @hibernate.collection-index column="position"
     * @hibernate.collection-key column="parent_id"
     * @struts.form-field
     */
    public List getChildren() {
        return children;
    }

    public void setChildren(List children) {
        this.children = children;
    }
   
    /**
     * Returns the position of the node in the children list (if it has parent).
     * @return int
     *
     * @hibernate.property column="position"
     */   
    public int getPosition() {
        try{
            return parent.getChildren().indexOf(this);
        }
        catch(NullPointerException e){
            // if it has no parent, position makes no sense
            return -1;
        }
    }
   
    public void setPosition(int position) { /* not used */ }
   
    /**
     * Returns the node's parent.
     *
     * @return Node
     *
     * @hibernate.many-to-one column = "parent_id" class="net.thogau.website.model.Node" cascade = "none"
     * @hibernate.column name="parent_id"
     */
     public Node getParent() {
        return parent;
    }
    
    public void setParent(Node n) {
        this.parent = n;
    }
   
    /**
     * @see java.lang.Object#equals(Object)
     */
    public boolean equals(Object object) {
        if (!(object instanceof Node)) {
            return false;
        }
        Node rhs = (Node) object;
        return new EqualsBuilder().append(this.name, rhs.name).append(
                this.children, rhs.children).append(this.parent, rhs.parent)
                .append(this.id, rhs.id).isEquals();
    }
   
    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode() {
        return new HashCodeBuilder(1036586079, -537109207).append(this.name)
                .append(this.parent.getName()).append(this.id)
                .toHashCode();
    }
   
    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("name", this.name).append("parent", this.parent)
                .append("id", this.id).append("position", this.getPosition()).toString();
    }
   
}

好像,equal ,hash 是必須的。

# /**
#      * 樹(shù)形遍歷
#      * 不用遞歸,用堆棧.
#      * 這里只是做為例子,本人不建議把業(yè)務(wù)邏輯封裝在Entity層.
#                 */ 
#     public List getVisitResults() { 
#         List l = new ArrayList(); 
#         Stack s = new Stack(); 
#         s.push(this); 
#         while (s.empty() == false) { 
#            Cat c = (Cat) s.pop(); 
#            l.add(c); 
#            List children = c.getChildren(); 
#               if (children != null) { 
#                  for (int i = 0; i <  hildren.size(); i++)   { 
#             Cat cat = (Cat) children.get(i); 
#             s.push(cat); 
#                  }//end for 
#              }//end if 
#         }//end while 
#         return l; 
#     } 






 









西津渡 2007-09-05 12:11 發(fā)表評(píng)論
]]>
lucene 的index 更新http://www.aygfsteel.com/stephen80/archive/2007/09/04/142612.html西津渡西津渡Tue, 04 Sep 2007 06:00:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/09/04/142612.htmlhttp://www.aygfsteel.com/stephen80/comments/142612.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/09/04/142612.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/142612.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/142612.html 所以,重新開(kāi) searcher 的頻率對(duì)于很重的訪(fǎng)問(wèn)量來(lái)說(shuō),不能太頻繁。這樣查詢(xún)肯定有不能同步的問(wèn)題。

對(duì)于不要求同步的場(chǎng)景來(lái)說(shuō),夠了。
繼續(xù)研究。







西津渡 2007-09-04 14:00 發(fā)表評(píng)論
]]>
solr 部署http://www.aygfsteel.com/stephen80/archive/2007/09/04/142611.html西津渡西津渡Tue, 04 Sep 2007 05:53:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/09/04/142611.htmlhttp://www.aygfsteel.com/stephen80/comments/142611.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/09/04/142611.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/142611.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/142611.html
jndi solr/home :

<Context docBase="D:\sourcecode\apache-solr\dist\solr.war" debug="0" crossContext="true" >
   <Environment name="solr/home" type="java.lang.String" value="D:\sourcecode\solr-sample\solr" override="true" />
</Context>

solr/home 的結(jié)構(gòu)
conf
data/index



西津渡 2007-09-04 13:53 發(fā)表評(píng)論
]]>
struts2 ognl 與 jsp2.1 el 的沖突問(wèn)題http://www.aygfsteel.com/stephen80/archive/2007/08/29/140988.html西津渡西津渡Wed, 29 Aug 2007 09:00:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/08/29/140988.htmlhttp://www.aygfsteel.com/stephen80/comments/140988.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/08/29/140988.html#Feedback1http://www.aygfsteel.com/stephen80/comments/commentRss/140988.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/140988.html由于 nio 帶來(lái)的性能提升,tomcat6 不能被忽略。

辦法1:

http://www.devzuz.org/blogs/bporter/2006/08/05/1154706744655.html

<ww:select list="#{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" />

改用-------------------------------------------------------------
<ww:select list="#@java.util.HashMap@{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" />

這樣 jsp2.1 el 就不會(huì)有問(wèn)題了。

辦法2: 對(duì)于舊的程序,不愿意改了,可以向后兼容
http://today.java.net/lpt/a/272#backwards-compatibility

必須用 Servlet 2.5 XSD.
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<jsp-property-group>
<deferred-syntax-allowed-as-literal>
true
</deferred-syntax-allowed-as-literal>


</jsp-property-group>
或者在頁(yè)面中
<%@page  language="java" deferredSyntaxAllowedAsLiteral="true" %>

辦法3 :不用 jsp2.1 el

> <jsp-config>
> <jsp-property-group>
> <url-pattern>*.jsp</url-pattern>
> <el-ignored>true</el-ignored>
> </jsp-property-group>
> </jsp-config>

http://www.mail-archive.com/dev@struts.apache.org/msg28920.html
我現(xiàn)在的疑問(wèn)
在一個(gè)頁(yè)面中采用兩個(gè) el 引擎,是否會(huì)對(duì)性能造成一定影響?
較小。



















西津渡 2007-08-29 17:00 發(fā)表評(píng)論
]]>
mod_cache http://www.aygfsteel.com/stephen80/archive/2007/08/27/140067.html西津渡西津渡Mon, 27 Aug 2007 09:44:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/08/27/140067.htmlhttp://www.aygfsteel.com/stephen80/comments/140067.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/08/27/140067.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/140067.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/140067.htmlLoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so

<IfModule mod_cache.c>
    <IfModule mod_mem_cache.c>
        CacheEnable mem /images
    CacheEnable mem /styles
    CacheEnable mem /scripts

        MCacheSize 10240
        MCacheMaxObjectCount 100
        MCacheMinObjectSize 1
        MCacheMaxObjectSize 2048
    </IfModule>
  
</IfModule>



西津渡 2007-08-27 17:44 發(fā)表評(píng)論
]]>
apach mod_http_proxy ,mod_rewrite 一起工作http://www.aygfsteel.com/stephen80/archive/2007/08/27/140029.html西津渡西津渡Mon, 27 Aug 2007 08:48:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/08/27/140029.htmlhttp://www.aygfsteel.com/stephen80/comments/140029.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/08/27/140029.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/140029.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/140029.html
<VirtualHost *:80>
 

RewriteLogLevel 3
RewriteLog "f:/temp/logs/lelerewrite.log"
RewriteEngine    on
RewriteRule    ^(.*)\.html$    http://www.lele.com/ [P]

 ProxyPass /images !
ProxyPass /styles !
ProxyPass /scripts !
  
 
  ProxyPass / http://localhost:8082/
 ProxyPassReverse / http://localhost:8082/
 ServerName www.lele.com:8082


 CustomLog logs/lele_access.log common

DocumentRoot "D:/apachedocroot/www.lele.com/"

 

<Directory />

    Options FollowSymLinks
    AllowOverride None
 
    Order allow,deny
    Allow from all


</Directory>


</VirtualHost>

一 、tomcat 中要配置:<connector ,proxy ,> .否則返回有問(wèn)題。
二、 mod_proxy_ajp 在 apr 情況下性能應(yīng)該比 mod_http_proxy 好。





西津渡 2007-08-27 16:48 發(fā)表評(píng)論
]]>
apache access log,關(guān)閉缺省http://www.aygfsteel.com/stephen80/archive/2007/08/27/139995.html西津渡西津渡Mon, 27 Aug 2007 08:13:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/08/27/139995.htmlhttp://www.aygfsteel.com/stephen80/comments/139995.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/08/27/139995.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/139995.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/139995.html #customLog logs/access.log common

在 virtualhost 中加
  CustomLog logs/lele_access.log common



西津渡 2007-08-27 16:13 發(fā)表評(píng)論
]]>
apache mod_rewritehttp://www.aygfsteel.com/stephen80/archive/2007/08/27/139910.html西津渡西津渡Mon, 27 Aug 2007 06:19:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/08/27/139910.htmlhttp://www.aygfsteel.com/stephen80/comments/139910.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/08/27/139910.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/139910.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/139910.html
在 <virtualHost> 中

RewriteLogLevel 3
RewriteLog "f:/temp/logs/sosorewrite.log"
RewriteEngine    on
RewriteRule    ^(.*)\.html$    /index.php


西津渡 2007-08-27 14:19 發(fā)表評(píng)論
]]>
用 apache mod_proxy_ajp 與 tomcat 集成, 很簡(jiǎn)單的步驟http://www.aygfsteel.com/stephen80/archive/2007/08/27/139846.html西津渡西津渡Mon, 27 Aug 2007 03:59:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/08/27/139846.htmlhttp://www.aygfsteel.com/stephen80/comments/139846.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/08/27/139846.html#Feedback1http://www.aygfsteel.com/stephen80/comments/commentRss/139846.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/139846.html  loadmodule mod_proxy
 loadmobule mod_proxy_ajp
 
 增加
 ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>


<VirtualHost *:80>
 
 ProxyPass /images !
ProxyPass /styles !
ProxyPass /scripts !
  
 ProxyPass / ajp://localhost:8009/
 ProxyPassReverse / ajp://localhost:8009/  
 ServerName www.lele.com:8082


 CustomLog logs/lele_access.log common

DocumentRoot "D:/apachedocroot/www.lele.com/"

 

<Directory />

    Options FollowSymLinks
    AllowOverride None
 
    Order allow,deny
    Allow from all


</Directory>


</VirtualHost>

tomcat 不用做修改。
安裝 tomcat apr, 性能會(huì)比較好。






西津渡 2007-08-27 11:59 發(fā)表評(píng)論
]]>
學(xué)習(xí)配置 apache 虛擬主機(jī)http://www.aygfsteel.com/stephen80/archive/2007/08/27/139823.html西津渡西津渡Mon, 27 Aug 2007 03:12:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/08/27/139823.htmlhttp://www.aygfsteel.com/stephen80/comments/139823.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/08/27/139823.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/139823.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/139823.html
Listen 80

NameVirtualHost *:80

<VirtualHost *:80>

DocumentRoot "D:/apachedocroot/www.soso.com/"
ServerName www.soso.com


<Directory />

    Options FollowSymLinks
    AllowOverride None
 
    Order allow,deny
    Allow from all

</Directory>


</VirtualHost>

<VirtualHost *:80>

DocumentRoot "D:/apachedocroot/static.soso.com/"
ServerName static.soso.com

<Directory />

    Options FollowSymLinks
    AllowOverride None
 
    Order allow,deny
    Allow from all

</Directory>

</VirtualHost>

二、修改 hosts 文件
三、 httpd.ext -S 測(cè)試配置




西津渡 2007-08-27 11:12 發(fā)表評(píng)論
]]>
j2ee 員學(xué)習(xí) 配置 apache2.2.4 php 5.2.3http://www.aygfsteel.com/stephen80/archive/2007/08/24/139174.html西津渡西津渡Fri, 24 Aug 2007 12:46:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/08/24/139174.htmlhttp://www.aygfsteel.com/stephen80/comments/139174.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/08/24/139174.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/139174.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/139174.html
配置 apache2.2.4 ,php 5.2.3.

1. 解壓到 c:\php
2. 拷貝 php.ini-dist 到 c:\windows 為 php.ini
    ** 不能用recommend**
3. 拷貝 php5ts.dll 到 c:\windows\system32

配置:apache ,http.conf
1. LoadModule php5_module "c:/php/php5apache2_2.dll"
    ** 對(duì)應(yīng)apache2.2 必須用這個(gè)**
2. AddType application/x-httpd-php  .php
3. if module dir_modle ,
    DirectoryIndex  index.php ,index.html

配置php.ini ,啟動(dòng) mysql
extension=php_mysql.dll
extension=php_mysqli.dll

測(cè)試
phpinfo.php

<? echo phpinfo(); ?>

ok.



西津渡 2007-08-24 20:46 發(fā)表評(píng)論
]]>
Mediator 設(shè)計(jì)模式http://www.aygfsteel.com/stephen80/archive/2007/08/07/134998.html西津渡西津渡Tue, 07 Aug 2007 08:43:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/08/07/134998.htmlhttp://www.aygfsteel.com/stephen80/comments/134998.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/08/07/134998.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/134998.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/134998.html就是兩個(gè)人之間要溝通,不是直接,而是通過(guò) mediator.
也就是 ,不是
        user1.sendMessage(user2,"some message");
       而是
        user1.getMediator().sendMessage("user2","some message");

 有什么好處呢:
        職責(zé)分離:mediator 完成自己該承擔(dān)的職責(zé)。
        mediator 也可以搞這搞那。

插一段實(shí)際代碼:
      conn.getChatManager().createChat("thewho@stephenli",new MessageListener() {

            public void processMessage(Chat chat, Message message) {
               
                if(logger.isDebugEnabled())
                logger.debug("Received message: " + message.toXML());
               
            }
        }).sendMessage("測(cè)試發(fā)送!");


下面是junit 一段別人的代碼,可以Run:

代碼看起來(lái)很蠢,不能說(shuō)明使用mediator 的好處。不過(guò)意思就是這樣啦!(從C# 拷的)


import junit.framework.TestCase;


public class MediatorTest extends TestCase {
   
    public void testMediator(){
        Mediator m = new Mediator();
        DataProviderColleague c1 = new DataProviderColleague(m);
        DataConsumerColleague c2 = new DataConsumerColleague();
        m.IntroduceColleagues(c1,c2);

        c1.ChangeData();
       
    }
}



    class Mediator
    {
        private DataProviderColleague dataProvider;
        private DataConsumerColleague dataConsumer;
        public void IntroduceColleagues(DataProviderColleague c1, DataConsumerColleague c2)
        {
            dataProvider = c1;
            dataConsumer = c2;           
        }
       
        public void DataChanged()
        {
            int i = dataProvider.getIMyData();
            dataConsumer.NewValue(i);
        }
    }

    class DataConsumerColleague
    {
        public void NewValue(int i)
        {
            System.out.println("New value "+ i);
        }
    }

    class DataProviderColleague
    {
        private Mediator mediator;
        private int iMyData=0;
        private int MyData ;
   
        public DataProviderColleague(Mediator m)
        {
            mediator = m;
        }

        public void ChangeData()
        {
            iMyData = 403;

            // Inform mediator that I have changed the data
            if (mediator != null)
                mediator.DataChanged();   
        }

        public int getIMyData() {
            return iMyData;
        }

        public void setIMyData(int myData) {
            iMyData = myData;
        }       
       
       
       
    }

 















西津渡 2007-08-07 16:43 發(fā)表評(píng)論
]]>
推薦一篇 StAX and WoodStox 的介紹文章,英文http://www.aygfsteel.com/stephen80/archive/2007/07/23/131820.html西津渡西津渡Mon, 23 Jul 2007 02:36:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/07/23/131820.html StAX the odds with Woodstox


剛讀了,感覺(jué)不錯(cuò)。

Over a decade into XML evolution, however, these parsing technologies are slowly showing their age, requiring bypasses and optimizations to overcome their well-known limitations. StAX, or Streaming API for XML, is the new-age XML parser that offers the best features of the existing models, and at the same time provides high performance and efficient access to the underlyi  閱讀全文

西津渡 2007-07-23 10:36 發(fā)表評(píng)論
]]>
規(guī)劃一下能力提高的步驟http://www.aygfsteel.com/stephen80/archive/2007/07/13/130116.html西津渡西津渡Fri, 13 Jul 2007 08:25:00 GMThttp://www.aygfsteel.com/stephen80/archive/2007/07/13/130116.htmlhttp://www.aygfsteel.com/stephen80/comments/130116.htmlhttp://www.aygfsteel.com/stephen80/archive/2007/07/13/130116.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/130116.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/130116.html1.rick  client 的全面掌握
  以前用dwr ,再?gòu)?fù)習(xí)一下  . ok ,prototypes . 07-08-01
2.db procedure
  以前基本不會(huì)。
3.ejb3
  高可靠性transaction
4. StAX, woodstox
   學(xué)習(xí)一下新的xml 處理技術(shù)。 ok.  07-08-01
5.REST
   新東西,很重要    .         ok. 07-08-1
6.english






西津渡 2007-07-13 16:25 發(fā)表評(píng)論
]]>
接口優(yōu)于繼承,組合優(yōu)于繼承http://www.aygfsteel.com/stephen80/archive/2006/07/21/59410.html西津渡西津渡Fri, 21 Jul 2006 06:05:00 GMThttp://www.aygfsteel.com/stephen80/archive/2006/07/21/59410.htmlhttp://www.aygfsteel.com/stephen80/comments/59410.htmlhttp://www.aygfsteel.com/stephen80/archive/2006/07/21/59410.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/59410.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/59410.html看來(lái)堅(jiān)持面向interface 的開(kāi)發(fā)是必須的了。
問(wèn)題在
? Abstract class 不能復(fù)雜,我想這也是template pattern 時(shí)候要注意的。
? template 要穩(wěn)定,不確定的東西不能放在template 中,當(dāng)然簡(jiǎn)單的東西容易穩(wěn)定。
?
?否則必然違背 ocp 原則。


西津渡 2006-07-21 14:05 發(fā)表評(píng)論
]]>
htmlparser 的裝死問(wèn)題http://www.aygfsteel.com/stephen80/archive/2006/07/21/59408.html西津渡西津渡Fri, 21 Jul 2006 06:00:00 GMThttp://www.aygfsteel.com/stephen80/archive/2006/07/21/59408.htmlhttp://www.aygfsteel.com/stephen80/comments/59408.htmlhttp://www.aygfsteel.com/stephen80/archive/2006/07/21/59408.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/59408.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/59408.htmlhtmlParser 會(huì)裝死。
我想只能加一個(gè)monitor thread ,不過(guò)沒(méi)有完成。


西津渡 2006-07-21 14:00 發(fā)表評(píng)論
]]>
htmlParser 遇到的encoding 問(wèn)題http://www.aygfsteel.com/stephen80/archive/2006/07/21/59407.html西津渡西津渡Fri, 21 Jul 2006 05:58:00 GMThttp://www.aygfsteel.com/stephen80/archive/2006/07/21/59407.htmlhttp://www.aygfsteel.com/stephen80/comments/59407.htmlhttp://www.aygfsteel.com/stephen80/archive/2006/07/21/59407.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/59407.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/59407.html??? 問(wèn)題在于 頁(yè)面的charset=gb2312 ,而 頁(yè)面中有g(shù)bk 的碼 ,比如 'fb9c'.
??? 代碼可以驗(yàn)證,
? ? ??? byte[] gbchar = new byte[2];
??? ??? gbchar[0]=(byte) 0xfb;
??? ??? gbchar[1]=(byte) 0x9c;
??? ??? System.out.print(new String(gbchar,"gbk"));
??? ??? System.out.print(new String(gbchar,"gb2312"));

??? 不過(guò),我并沒(méi)有解決這個(gè)問(wèn)題。



西津渡 2006-07-21 13:58 發(fā)表評(píng)論
]]>
webalizer 作點(diǎn)擊量統(tǒng)計(jì)http://www.aygfsteel.com/stephen80/archive/2006/04/30/44228.html西津渡西津渡Sun, 30 Apr 2006 08:33:00 GMThttp://www.aygfsteel.com/stephen80/archive/2006/04/30/44228.htmlhttp://www.aygfsteel.com/stephen80/comments/44228.htmlhttp://www.aygfsteel.com/stephen80/archive/2006/04/30/44228.html#Feedback1http://www.aygfsteel.com/stephen80/comments/commentRss/44228.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/44228.html

西津渡 2006-04-30 16:33 發(fā)表評(píng)論
]]>
用clickStream 做業(yè)務(wù)日志http://www.aygfsteel.com/stephen80/archive/2006/04/30/44227.html西津渡西津渡Sun, 30 Apr 2006 08:31:00 GMThttp://www.aygfsteel.com/stephen80/archive/2006/04/30/44227.htmlhttp://www.aygfsteel.com/stephen80/comments/44227.htmlhttp://www.aygfsteel.com/stephen80/archive/2006/04/30/44227.html#Feedback0http://www.aygfsteel.com/stephen80/comments/commentRss/44227.htmlhttp://www.aygfsteel.com/stephen80/services/trackbacks/44227.html

西津渡 2006-04-30 16:31 發(fā)表評(píng)論
]]>
主站蜘蛛池模板: 竹山县| 古蔺县| 灵川县| 麻城市| 新建县| 五峰| 五指山市| 孝感市| 定西市| 渝中区| 威信县| 连州市| 湖口县| 米泉市| 新兴县| 瓦房店市| 江山市| 榆树市| 应城市| 康保县| 浏阳市| 融水| 杭州市| 河源市| 昌平区| 公主岭市| 紫阳县| 海淀区| 特克斯县| 漾濞| 通渭县| 疏附县| 二连浩特市| 许昌市| 安仁县| 绩溪县| 南皮县| 旬阳县| 舟山市| 台南县| 西华县|