为什么大多数大型网站不是用Java写的

国庆长假,老外在热烈的讨论这个话题,

原文地址: http://natishalom.typepad.com/nati_shaloms_blog/2007/10/why-most-scalab.html

我摘录部分观点如下:

Most of these sites are using LAMP as the core runtime stack

Some develop their own file system (Google, GFS)

Some are using caching to solve the database bottleneck (memcached and the like)


--


introducing similar solutions for addressing the scalability challenges: 在解决伸缩性方面的尝试:

On the Data Tier we see the following:

1. Adding a caching layer to take advantage of memory resources

availability and reduce I/O overhead
2. Moving from a database-centric approach to partitioning, aka shards

注:shards是google贡献给hibernate的一个项目,他是hibernate的一个扩展,可以

透明的实现数据的分布存储。至于如何分布存储由你自己定义策略,例如典型的

RoundRobinShardSelectionStrategy

 

On the Business Logic Tier:

3. Adding parallelization semantics to the application tier (e.g.,

MapReduce)
注:MapReduce是Google开发的C++编程工具,用于大规模数据集(大于1TB)的并行运算。MapReduce通过把对数据集的大规模操作分发给网络上的每个节点实现可靠性;每个节点会周期性的把完成的工作和状态的更新报告回来。MapReduce会生成大量的临时文件,为了提高效率,它利用Google文件系统来管理和访问这些文件。


4. Moving to scale-out application models to achieve linear scalability
注:
scaling:the ability of an application to address growth in throughput,

usage, and capacity
有两种策略:scale out 和 scale up
scale up vs scale out 的区别在于:
 1 Reliance on hardware versus reliance on software
 2 Equation with "first-class" hardware versus "commodity" hardware
 3 Massive versus incremental capacity increases
 4 Centralized versus partitioned application architectures
简单的说就是一个靠提升单个硬件的配置,另一个靠用低端配置实现集群


5. Moving away from the classic two-phase commit and XA for transaction

processing  (See: Lessons from Pat Helland: Life Beyond Distributed

Transactions)
注: 不使用传统的分布式事务处理,例如EJB的事务,使用新的基于space的中间件平台 Space Based Architecture (SBA) and GigaSpaces XAP

Java中,将大型TIF(Tagged Image File Format)文件转换为PNG(Portable Network Graphics)格式可以通过使用专门的图像处理库来完成。常用的库包括Apache Commons Imaging、ImageIO以及第三方库如GeoTools中的GTiffReader。以下是使用Java进行转换的一个基本步骤: 1. 添加依赖:首先,确保你的项目中包含了处理TIF和PNG格式的库依赖。如果使用Maven,你可以在`pom.xml`文件中添加相应的依赖。 2. 读取TIF文件:使用相应的库函数打开并读取TIF文件。例如,使用ImageIO读取文件时,可以使用`ImageIO.read(new File(tifFilePath))`。 3. 转换图像格式:将读取到的图像转换成PNG格式。大多数图像处理库都提供转换为PNG的方法。 4. 保存PNG文件:将转换后的图像保存为PNG文件。 5. 资源管理:确保在转换过程中妥善管理资源,如关闭打开的文件流等。 示例代码: ```java import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class TifToPngConverter { public static void convertTiffToPng(String tifFilePath, String pngFilePath) throws IOException { // 读取TIF文件 BufferedImage image = ImageIO.read(new File(tifFilePath)); // 将BufferedImage保存为PNG格式 File outputFile = new File(pngFilePath); ImageIO.write(image, "png", outputFile); } } ``` 注意:处理大型文件时,可能会遇到内存溢出的问题。因此,可能需要使用图像流处理技术,分块读取和转换图像,以避免一次性加载整个图像到内存中。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值