mod_jk 只有 For Solaris Sparc 的? Binary ， 所以只好手工编译了。 其实很简单的步骤，也算更新一下以前的那个文章吧。
分类 ‘Apache’ 归档文章
查看原来的编译时的 config.log 文件，老样子做： $ ./configure –prefix=/usr/local/squid –enable-follow-x-forwarded-for
升级完以后，发现大量的公网 IP 不同端口到 80 端口的连接，导致网站访问速度变慢。修改原来的配置文件：
# http_port 18.104.22.168:80 transparent
http_port 22.214.171.124:80 accel defaultsite=freelamp.com vhost
#cache_peer 127.0.0.1 parent 80 0 no-query originserver name=my_peer
# 添加 login=PASS，来传递 http basic authentication 的用户名和口令，否则失效。
cache_peer 127.0.0.1 parent 80 0 no-query originserver login=PASS name=my_peer
acl mypeerdomain dstdomain 126.96.36.199 .freelamp.com
http_access allow mypeerdomain
cache_peer_access my_peer allow mypeerdomain
cache_peer_access my_peer deny all
reload squid 服务后，原来的 80 端口 connection 都变成了 127.0.0.1 的 connection。网站访问速度顿时急速提升。
Dell E6400 每次开机半个小时左右，机器 CPU 就 100% ，会感觉到底部发热， 风扇高速运转。
查看软件因素，重新安装 Windows7 Enterprise 后依然如故。
根据同事的指点，安装了 Core Temp 软件，检测每个 Core 的温度，发现系统 100% CPU 时，频率都是 800MHz，而不是可以达到的最高 2800 MHz.
叫 Dell 更换了 CPU 风扇，一切都正常了，原来 Skype 每次启动都 100% CPU 的情况也没有了。
CPU 到 100% 时，系统日志会报如下信息：
The speed of processor 0 in group 0 is being limited by system firmware. The processor has been in this reduced performance state for 71 seconds since the last report.
The speed of processor 1 in group 0 is being limited by system firmware. The processor has been in this reduced performance state for 71 seconds since the last report.
Unix/Linux 操作系统的远程日志写入无非是定义 loghost ，然后 enable remote message logging。
在 Solaris 10 要检查 /lib/svc/method/system-log 文件，确保没有特别的参数传送给 /usr/sbin/syslogd。
可以强制加 -T 参数实现远程 UDP 日志写入，针对局域网内的交换机之类的设备把日志写入 Unix 主机，然后用脚本检查日志文件来达到监控交换机等设备的目的。在 Brocade 光纤交换机上可以用 syslogdipshow/syslogdipadd/syslogdipremove 来修改日志服务器的 IP 地址。
一篇老文章，关于 JS Code 的 Load 顺序，值得一读。
Multithreading Strategies With Sun Products and Technologies
By Nagendra Nagarajayya, June 2007
Multithreading increases the efficiency of a resource by running multiple tasks at the same time. Multithreading techniques can be implemented in software (at the operating system level or as a user application library) and in hardware (at the processor level). This article discusses the advantages of multithreading and the multithreading offerings available from Sun.
The following topics are covered in this article:
What Is Multithreading?
Multithreading is a technique that allows a program or a process to do many tasks concurrently (at the same time and parallel) . Multithreading allows a process to run tasks in parallel on a symmetric multiprocessing (SMP) system or a chip multithreading  (CMT) system, allowing the process to scale linearly with the number of cores or processors, which improves performance, increases efficiency, and increases throughput.
What Are Processes and Threads?
A process is a heavyweight entity that lives inside the kernel. It consists of the address space, registers, stack, data, memory maps, virtual memory, user IDs, file descriptors, kernel states, and so on.
A thread is a lightweight entity that can live in the user space or the kernel and consists of registers, stack, and data. Multiple threads share a process, that is, they share the address space, user IDs, virtual memory, file descriptors, and so on. The threads within a process share data, and they can see each other.
What Is Multiprocess Programming?
Running multiple processes concurrently is called multiprocess programming. The processes can share data through shared memory, files, database, memory maps, and so on.
What Are the Advantages of Multithreading Over Multiprocess Programming?
A thread is lightweight, so many threads can be created to use resources efficiently. The threads are all within a process so they can share global data. A blocking request by one thread will not stop another thread from executing its task. Also, the process will not get context-switched because a thread is blocked.
The result of multithreading is increased performance, increased throughput, increased responsiveness, the ability to execute tasks repeatedly, increased efficiency, better management of resources, and lowered costs. A thread context-switch is extremely fast and can be in user space or at the kernel central processing unit (CPU) level.
A process is heavyweight, so it costs more to context-switch a process than a thread. Multiprocess programming is much more difficult than multithreaded programming, performance is slower, and management of resources is difficult. Also, synchronization and shared memory use are more difficult with processes than with threads, because threads share memory at the process level and global memory access is easy with threads.
Why Do Companies Build Multithreading Into Their Products?
A multithreading strategy allows a company to offer products that can deliver better performance, which lowers customers’ total cost of ownership (TCO). Such products can take advantage of parallelism in hardware through SMP or CMT to execute many tasks in parallel, which does the following, among other things:
* Reduces computation time
* Improves performance
* Improves responsiveness
* Enables better interaction between users and multithreaded applications
* Increases efficiency when managing resources
* Reduces time to market
* Reduces human resources costs
* Provides portability
* Improves users’ perceptions of the products
* Increases competitiveness
* Reduces contentions for resources such as OS structures, disk, memory, CPU, and so on
What Competitive Advantages Can Sun’s Multithreading Products Provide to Customers?
Sun is considered a leader in multithreaded technology, including CMT, and Sun was one of the first companies to offer SMP-based systems.
Sun’s UltraSPARC T1 processor  can handle eight different tasks from eight different threads simultaneously in a single clock cycle. The UltraSPARC T1 processor itself is multithreaded in hardware to improve the efficiency, and it has four hardware threads per core.
Sun’s new UltraSPARC T2 processor  has 16 pipelines with 4 vertical threads each and can handle 16 tasks simultaneously, improving core efficiency and increasing the throughput almost 3x compared to the T1 processor.
The UltraSPARC IV+ is a multicore processor and can handle two different tasks from two different threads simultaneously. The APL  processor has four cores and two hardware threads per core. The upcoming “Rock”  processor will have 16 cores with two hardware threads per core.
Sun’s multithreaded strategy is not limited to processors. The Solaris OS has a multithreaded kernel, and it has been multithreaded since the Solaris 2.0 OS release. Software programs running on the Solaris OS can be single threaded or multithreaded. The Solaris OS has a 1×1 threading model and scales up to 128 cores with the Sun Fire E25K server (Sun’s largest system).
Sun also provides free, open source tools for developing multithreaded applications on the Solaris OS. The tools range from integrated development environments (IDEs) to compilers, optimized libraries, multithreaded malloc, atomic operations, and automatic parallelization technologies. (Note: While the IDE is based on open source NetBeans, the compilers and libraries are free, but not open source.)
In addition, Sun invented the Java platform, and the Java language provides multithreading support as part of the language, not as another library. Java applications scale from the smallest devices, such as Java Card and Java Ring, to mobile phones, to applications servers running on the Sun Fire E25K server.
Sun introduced throughput computing to reduce the cost and complexity of computing. In throughput computing, the idea is to maximize workload throughput in a known amount of time through CMT technology. CMT technology can process multiple tasks from multiple software threads simultaneously, which improves throughput compared to single threaded processing on single threaded processors. Improved throughput reduces the cost of computing because fewer systems are needed to do the same amount of work. Fewer systems mean reductions in system management, costs, and power consumption, all of which are beneficial as companies strive to improve their profits by reducing capital expenditures and operating expenditures.
Using Sun products, customers can gain a competitive advantage because they can provide their own end-to-end solutions or use end-to-end solutions from Sun. For increased performance, customer applications can scale from a single processor to 128 cores. In addition, the Solaris OS is open source , so there are no license fees for customers. (Note: There are no license fees for software. Support and services might not be free.)
Sun has also open sourced the application server and in fact offers the Sun Java Enterprise System at a per employee plan, reducing the cost of ownership of enterprise software. The Sun Java Enterprise System provides servers and applications that can be used to develop, run, and manage applications on devices from mobile devices to large Sun Fire E25K systems. These applications include application servers, portal servers, web servers, enterprise service buses, identity management, content management, and so on.
In addition, Sun has partnered with Oracle and other database (DB) vendors to offer savings for databases running on Sun products. Sun offers free, open source databases (such as MySQL, PostgreSQL , and Enterprise DB) with its systems, and Sun supports PostgreSQL.
What Sun Products Have Multithreading Capability?
Sun offers the following hardware and software with multithreading capability:
* UltraSPARC T1 processor-based Sun Fire T1000 and T2000 systems; Netra CP3060 UltraSPARC T1 ATCA Blade, an enterprise blade; plus the Netra T2000 NEBS system
* UltraSPARC IV+ processor-based systems, such as the Sun Fire V490, Sun Fire E4900, Sun Fire E6900, and Sun Fire E25K servers
* Advanced Product Line (APL) processor-based systems
* x86-processor based systems, such as the Sun Fire X2200 server, Sun Fire X4200 server, and so on
* The new UltraSPARC T2 processor-based systems and “Rock” processor-based systems (, )
* The Solaris Operating System
* Java technology, all Java technology-based products, Sun Java Enterprise System, and so on
* Sun Java System Messaging Server
* Sun Java System Identity Manager
* N1 Grid Software
* Sun Studio compilers 
* StarOffice software
* NetBeans IDE 
What Are the Innovative Features of Sun’s Hardware and Software?
From thin clients to big servers such as the Sun Fire E25K server, many Sun products are SMP-based or CMT-based.
Sun’s software products are open source (free or can be licensed), offering cost savings to an enterprise or company. The Solaris OS (which runs on SPARC and x86 platforms) can scale from a desktop to 128 cores.
The Solaris OS is open source and multithreaded at the kernel level. It was the one of the first forms of UNIX to offer this feature, a preemptible , multithreaded kernel. The OS offers a 1×1 threading model, and offers optimized threading primitives and a POSIX standards interface. Sun offers a binary compatibility guarantee that products compiled on the Solaris OS run without any changes from desktops to the E25K server. The Solaris OS offers an optimized Java Virtual Machine (JVM) to run Java applications. The JVM leverages Solaris threads to improve scalability and can scale up to 128 cores. The Solaris platform also offers free optimizing compilers, IDE to develop and debug multi-threaded applications. It also offers tools like lock-lint, data-race detection tools, performance analyzers, profilers, OpenMP , Sun Message Passing Interface (MPI) , high-performance computing (HPC) features, grid computing , and so on.
What Is Sun’s Open Source Strategy?
Many Sun software products are free or they can be licensed . Sun has open sourced the Solaris OS as OpenSolaris, the Java language platform as OpenJDK, and the Sun Java Application Server as GlassFish . The new UltraSPARC T1 processor is also open source. The following are some of the Sun open source products and their licensing arrangements:
* OpenSolaris software with a Common Development and Distribution License (CDDL)
* OpenJDK (Java language platform) software with a General Public License (GPL)
* Java ME (Java Mobile Edition) software with a GPL
* OpenSPARC processor (UltraSPARC T1 processor) with a GPL
* GlassFish (Sun Java Application Server) with a CDDL
* NetBeans IDE with a CDDL
* OpenOffice  with a Lesser General Public License (LGPL)
* Grid Engine 
Sun also offers Sun Java Enterprise System on a “per employee” plan, reducing the cost of ownership for enterprise software.
Sun also makes available and supports open source products such as Apache, PHP, GNU compilers, and so on.
How Can Application Developers Take Advantage of Sun’s Multithreaded Products?
Sun products are multithreaded from hardware to software. Developers can make use of multithreaded hardware and software products and the open source Solaris OS to test their multithreaded products for scalability on the CMT systems.
Here are some ways in which developers can leverage Sun’s multithreaded hardware and software products:
* Developers can make use of free, open source Java technology to develop their applications, which can then run not only on Sun systems and the Solaris OS but also on other platforms, such as Windows, Linux, IBM, HP, and so on.
* Developers can develop their applications with the free, open source-based NetBeans IDE. They can also make use of Sun Studio compilers, debugger, and tools, such as the static lock analyzer, the optimizer, the profiler, the performance boosting libraries, automatic parallelization, openMP, and so on, to write applications in C, C++, or Fortran.
* Developers can access the Sun developer web site, which provides how-to information, performance tuning information, white papers, case studies, and tutorials on many subjects.
* Sun offers partners the Partner Advantage program, which can be used to tune products in Sun labs by working with the ISV Engineering group and product engineers. Products can be performance tuned, sized, benchmarked, and so on.
* Developers interested in grid or Software as a Service (SaaS) technologies can make use of the Sun Grid to run their high computation programs.
* Developers interested in highly parallel, multithreaded packet processing applications on bare silicon can use the Netra Data Plane Software Suite for fast-path network processing.
Here are some additional things I recommend:
* Applications and servers: Use the Java programming language for standalone applications.
* Web-based applications: Use Java Platform, Enterprise Edition (Java EE) technologies, if possible, such as thin client architectures, JavaServer Pages, JavaServer Faces, and frameworks such as Spring.
* OS: Use the Solaris 10 OS (for x86 or SPARC platforms), which is free, open source, fast, and scales up to 128 cores.
* Sun Fire T2000 server: Use for web-based applications, not for computation intensive applications.
* UltraSPARC IV+ processor-based systems: Use for computation intensive and high-performance systems.
* UltraSPARC T2 processor-based systems: Use for web-based applications, computation intensive applications, network applications, packet processing applications, and database applications on low to midrange systems.
* Rock processor-based and APL processor-based systems: Use for computation-intensive, database and high-performance systems (midrange-high-end).
* Systems based on x86 AMD Opteron and Intel processors: Use for low-cost, web-based, computation intensive applications and low-end to midrange databases.
Note: You can send me an email to get more information.
I would like to thank ISV Engineering, specifically Jim Parkinson, Dan Powers, and Mayank Srivastava, for supporting me in my presentation on Sun multithreading strategies. I wish to thank James Baty and Jeremy Barnish for their help.
I would also like to thank Morgan Herrington for reviewing the contents, which increased the readability and accuracy of this article, Christophe Ebro for reviewing and providing very valuable feedback, and Tai-Wei (David) Lin for his suggestions. And thanks to the team at developers.sun.com.