跳到主要內容

發表文章

目前顯示的是 9月, 2009的文章

MySQL INSERT 修飾詞

<br />INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]<br /> [INTO] tbl_name [(col_name,...)]<br /> {VALUES | VALUE} ({expr | DEFAULT},...),(...),...<br /> [ ON DUPLICATE KEY UPDATE<br /> col_name=expr<br /> [, col_name=expr] ... ]<br /> DELAYED 由MySQL所添加的專屬指令,Client在送出Insert命令後,若此時MySQL無法執行此命令,則會將此命令放入INSERT-Buffer內等候可用時間再將資料寫入table,Client無須等候MySQL完成此命令便可繼續處理後續工作執行 缺點 INSERT DELAYED指令即使在Table處於可用狀態下的執行效能仍低於標準INSERT指令,INSERT DELAYED對於MySQL會有額外的系統負擔,因為每一個用於INSERT DELAYED的TABLE必須要有一個個別的Thread處理這些被Delayed-Rows的insert工作 風險: 因為Insert Delayed是採用memory-buffer方式儲存Delayed Rows,若是不當使用kill command或是系統當機,將可能造成資料遺失 支援引擎: MyISAM / Memory / Archive Tables LOW_PRIORITY 採用此修飾詞的insert會等候資料table在無任何client存取的情況下才會執行此insert動作, (I/O量大的Tables 有可能造成 Long-Time Waiting狀態產生) 支援引擎: MyISAM / Memory / Archive Tables

MySQL -- Truncate Table

通常清除Table內的所有資料採用 Delete SQL命令的做法並不好,除了效率不好之外另外也可能造成過度使用系統資源,因此DBCS都會提供快速刪除資料的方式 MySQL在5.03版之前,InnoDB Truncate採用 Row by Row方式刪除每一筆資料 5.0.3之後除非Table本身有Foreign Key參考到本table是採用Row by Row方式刪除資料 若無Foerign Key的話則採用 Fast-Truncate方式( Drop & Re-create )重建新 Table 並且會 Reset AUTO_INCREMENT 計數器 而在5.0.13版本之後無論是否採用 Fast-Truncat都會重置 AUTO_INCREMENT 計數器 ** Trigger注意事項 Truncate 若不採用Delete SQL Command 因此並不呼叫任何 ON DELETE Trigger

NLB Parameters: miimon

MIIMON stands for media-independent interface monitoring its value is set in milli seconds which defines how often mii link monitoring occurs then it will checks if NICs is active or not To check if NIC drivers supports MII, please use the following commands: # ethtool eth0 |grep "Link detected" Link detected: yes

MySQL Virtualization Performance Issues

Often the biggest consideration is the performance of a virtualized environment once hosted. In most cases, the virtualized environment involves some level of emulation of one or more of the hardware interfaces (CPU, network or disk) of the host environment. The effect is to reduce the effective performance of the virtualized environment compared to running an application natively on the host. Some core resourcing issues to be aware of include: •Using virtualization does not reduce the amount of CPU required to support a particular application or environment. If your application stack requires 2GB of RAM on an individual machine, the same RAM requirement will apply within your virtualized environment. The additional overhead of the virtualization layer and host operating system or environment often mean that you will need 2.5GB or 3GB of RAM to run the same application within the virtualized environment. You should configure your virtualization environment with the correct RAM allocati

MySQL HA 建議

MySQL 的High Availability 設計參考資訊 Requirements MySQL Replication MySQL Replication + Heartbeat MySQL Heartbeat + DRBD MySQL Cluster MySQL + memcached Availability Automated IP failover No Yes Yes No No Automated database Failover No No Yes Yes No Typical failover time User/script-dependent Varies < 30 seconds < 3 seconds App dependent Automatic resynchronization of data No No Yes Yes No Geographic redundancy support Yes Yes Yes, when combined with MySQL Replication Yes, when combined with MySQL Replication No Scalability Built-in load balancing No No No Yes Yes Supports Read-intensive applications Yes Yes Yes, when combined with MySQL Replication Yes Yes Supports Write-intensive applications No No Yes Yes No Maximum number of nodes per group One master, multiple slaves One master, multiple slaves One active (primary), one passive (secondary) node 255 Unlimited Maximum number of slaves Unlimited (reads only) Unlimited (reads only) One (failover only) Unlimited (reads only) Unlimite

MySQL 5.4發展

MySQL 5.4主要是以 5.1版的核心為主要架構,再針對特殊應用加以修改或是補強功能設定 以下是我個人比較關注的部分 架構調整與改進 5.4最主要是針對多核心系統加以改進,以往要增進MYSQL的執行速度都過於仰賴 CPU Clock Speed 提升效能,現今的主機都以 Multi-Core 為主要架構,因此5.4版便是針對Multicore架構做調整,增進 mySQL的執行效能,使mySQL可以充分利用SMP系統 增進的部分主要針對 InnoDB 的locking,記憶體管理與執行緒同步管理問題 的增進 後續會將 5.4使用心得更新到本部落格

Window CE BootLoader for x86 ( MS-DOS )

CEPC X86採用了幾種開機方式,其中一種運用MS-DOS當成Booting OS 利用 Windows CE Platform builder所提供的 Image disk 製作一片 1.44M的開機片,內有提供 LoadCepc.exe命令作為 CE Boot Loader 不過首先得先將磁片的開機檔案移植到嵌入式設備的CF / FLASH / DISK 上 以下提供傳統的MS-DOS開機系統製作方式供學員參考 : 使用MS-DOS開機片開機後, 透過 Fdisk.exe與 Format.com 工具製作 Windows CE Boot Loader 過程如下 圖一: MS-DOS開機 圖2: 開機後,載入 Fdisk執行 Partition切割工作 圖3: 選擇第一項,建立 Partition 圖4: 選擇第一項,建立 DOS Partition 圖5: 詢問是否全部切割成單一PARTITION,若CF過大可回答 N 自行切割大小 圖6: 輸入欲切割的Partition大小 圖7:切割後,按一下鍵盤的 esc鍵回到檢視畫面,就可看到所切割的Partition大小 圖8: esc回到主選單後,在選擇 [2] 設定啟動磁區 圖9: 選擇欲啟動作業系統的Partition 圖10: 選擇後應該會看到 Partition清單上的 Status欄位出現 A 字元 圖11: 切割後 重新啟動系統 圖12: 格式化所切割的新磁區 圖13: 格式化完成後 便可將 Platform Builder所製作的 Windows CE Bootloader磁片內容複製到C:內 重新開機後,進入c:> 輸入 C:>Loadcepc /L:800x600x16 nk.bin 便可載入nk.bin到記憶體 並且以800x600的解析度執行 windows ce 作業系統

NLB Operation Mode / Modes of Bonding

mode=1 (active-backup) Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode. mode=2 (balance-xor) XOR policy: Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance. mode=3 (broadcast) Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance. mode=4 (802.3ad) IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification. Prerequisites: Ethtool support in the base drivers fo

NLB in CentOS

設定CentOS NLB 備忘錄 1.增加虛擬網卡 編輯 /etc/modeprobe.conf 增加下列設定 以 mode 5 為例 Mode 模式參考文章 alias bond0 bonding options bond0 miimon=80 mode=5 2.設定虛擬網卡啟動資訊 建立 /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 IPADDR=192.168.1.100 NETMASK=255.255.255.0 NETWORK=192.168.1.0 BROADCAST=192.168.1.255 GATEWAY=192.168.1.1 ONBOOT=yes BOOTPROTO=none USERCTL=no 3.設定實體網卡啟動資訊 /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 ONBOOT=yes BOOTPROTO=none USERCTL=no MASTER=bond0 SLAVE=yes /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 ONBOOT=yes BOOTPROTO=none USERCTL=no MASTER=bond0 SLAVE=yes

Windows System Programming

Windows System Programming 開發系統程式必學知識

Windows Driver 開發系列

Developing Drivers with the Windows Driver Foundation