为什么大多数大型网站不是用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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是使用Java的方法来拷贝文件夹的示例代码: ```java import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class FolderCopyExample { public static void main(String[] args) { // 源文件夹路径 String sourceFolder = "C:\\Users\\username\\sourceFolder"; // 目标文件夹路径 String targetFolder = "C:\\Users\\username\\targetFolder"; try { // 创建目标文件夹 Path targetPath = Paths.get(targetFolder); if (!Files.exists(targetPath)) { Files.createDirectories(targetPath); } // 拷贝文件夹 Path sourcePath = Paths.get(sourceFolder); Files.walk(sourcePath).forEach(source -> { Path target = targetPath.resolve(sourcePath.relativize(source)); try { Files.copy(source, target); } catch (IOException e) { System.err.println("Failed to copy " + source + " to " + target + ": " + e.getMessage()); } }); System.out.println("Folder copied successfully."); } catch (IOException e) { System.err.println("Failed to copy folder: " + e.getMessage()); } } } ``` 在此示例中,我们使用Java的Path和Files类来遍历源文件夹中的所有文件和子文件夹,并将它们复制到目标文件夹中。我们还使用Files.createDirectories()方法创建目标文件夹。 这是一个简单的方法,可以在大多数情况下很好地工作,但在处理大型文件夹时可能会遇到性能问题。在这种情况下,您可能需要使用更高级的技术,如多线程处理。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值