- 浏览: 251491 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
wilsonchen:
...
pdf.js html5展现pdf -
angole:
不错,又学习到了。
mybatis打印sql -
hft24dq:
rxcss66 写道 个人没有搞明白什么原理,不过跟一楼说的一 ...
mybatis打印sql -
fireinjava:
fireinjava 写道org.apache.ibatis. ...
mybatis打印sql -
fireinjava:
org.apache.ibatis.logging.LogFa ...
mybatis打印sql
1、一个连接一个进程
2、能处理很多的并发连接
3、使用的场景:
What it's good for
As you've seen so far, Node is extremely well designed for situations where you are expecting a high amount of traffic and the server-side logic and processing required isn't necessarily large before responding to the client. Good examples of where Node would excel include:
A RESTful API
A web service that provides a RESTful API takes in a few parameters, interprets them, pieces together a response, and flushes a response (usually a relatively small amount of text) back to the user. This is an ideal situation for Node, because you can build it to handle tens of thousands of connections. It also doesn't require a large amount of logic; it just looks up values from a database and pieces together a response. Since the response is a small amount of text, and the incoming request is a small amount of text, the traffic volume isn't high, and one machine can likely handle the API demands of even the busiest company's API.
Twitter queue
Think about a company like Twitter that has to receive tweets and write them to a database. There are literally thousands of tweets arriving every second, and the database can't possibly keep up with the number of writes required during peak usage times. Node becomes an important cog in the solution to this problem. As we've seen, Node can handle tens of thousands of incoming tweets. It can write them quickly and easily to an in-memory queuing mechanism (memcached for example), from which another separate process can write them to the database. Node's role in this is to quickly gather the tweet and pass this information off to another process responsible for writing it. Imagine another design — a normal PHP server that tries to handle writes to the database itself — every tweet would cause a small delay as its written to the database since the database call would be blocking. A machine with this design may only be able to handle 2000 incoming tweets a second, due to the database latency. A million tweets per second requires 500 servers. Node, instead, handles every connection and doesn't block, enabling it to capture as many tweets as possible. A node machine able to handle 50,000 tweets per second requires only 20 servers.
Image file server
A company that has a large distributed website (think Facebook or Flickr), could decide to devote entire boxes to simply serving up images. Node would be a good solution for this problem because the company can use it to code an easy file retriever and then handle tens of thousands of connections. Node would look for the image file, return it or a 404 error, and do nothing else. This setup would allow these types of distributed websites to reduce the number of server boxes they need to serve static files such as images, .js files, and .css files.
What it's bad for
Of course, Node is not the ideal choice in some situations. Here are scenarios where Node would not excel:
Dynamically created pages
Currently, Node doesn't provide a default way to create dynamic pages. For example, when using JavaServer Pages (JSP) technology you can create an index.jsp page that contains loops in JSP snippets like <% for (int i=0; i<20; i++) { } %>. Node doesn't enable these types of dynamic HTML-driven pages. Again, Node isn't ideally suited to be a web page server, as Apache and Tomcat are. Therefore, if you wanted to provide a server-side solution for this in Node, you'd have to code the entire solution yourself. A PHP programmer wouldn't want to program a PHP converter for Apache every time they deployed a web application, but at this point, that's what Node would require you to do.
Relational database heavy applications
Node is designed to be fast, asynchronous, and non-blocking. Databases don't necessarily share these goals. They are synchronous and blocking, as calls to the database on writes and reads block until a result is generated. So, a web application that requires a lot of database calls, a lot of reads, and a lot of writes with every request would be a bad match for Node, since the relational database itself would be negating many of the strengths of Node. (The new NoSQL databases are a better match for Node, but that's another topic entirely.)
Node accomplishes its goals of providing highly scalable servers. It doesn't allocate a thread-per-connection model, but instead uses a process-per-connection model, creating only the memory that is required for each connection. It uses an extremely fast JavaScript engine from Google, the V8 engine. It uses an event-driven design to keep code minimal and easy-to-read. All of these factors lead to Node's desired goal — it's relatively easy to write a massively scalable solution.
http://www.ibm.com/developerworks/opensource/library/os-nodejs/index.html
2、能处理很多的并发连接
3、使用的场景:
What it's good for
As you've seen so far, Node is extremely well designed for situations where you are expecting a high amount of traffic and the server-side logic and processing required isn't necessarily large before responding to the client. Good examples of where Node would excel include:
A RESTful API
A web service that provides a RESTful API takes in a few parameters, interprets them, pieces together a response, and flushes a response (usually a relatively small amount of text) back to the user. This is an ideal situation for Node, because you can build it to handle tens of thousands of connections. It also doesn't require a large amount of logic; it just looks up values from a database and pieces together a response. Since the response is a small amount of text, and the incoming request is a small amount of text, the traffic volume isn't high, and one machine can likely handle the API demands of even the busiest company's API.
Twitter queue
Think about a company like Twitter that has to receive tweets and write them to a database. There are literally thousands of tweets arriving every second, and the database can't possibly keep up with the number of writes required during peak usage times. Node becomes an important cog in the solution to this problem. As we've seen, Node can handle tens of thousands of incoming tweets. It can write them quickly and easily to an in-memory queuing mechanism (memcached for example), from which another separate process can write them to the database. Node's role in this is to quickly gather the tweet and pass this information off to another process responsible for writing it. Imagine another design — a normal PHP server that tries to handle writes to the database itself — every tweet would cause a small delay as its written to the database since the database call would be blocking. A machine with this design may only be able to handle 2000 incoming tweets a second, due to the database latency. A million tweets per second requires 500 servers. Node, instead, handles every connection and doesn't block, enabling it to capture as many tweets as possible. A node machine able to handle 50,000 tweets per second requires only 20 servers.
Image file server
A company that has a large distributed website (think Facebook or Flickr), could decide to devote entire boxes to simply serving up images. Node would be a good solution for this problem because the company can use it to code an easy file retriever and then handle tens of thousands of connections. Node would look for the image file, return it or a 404 error, and do nothing else. This setup would allow these types of distributed websites to reduce the number of server boxes they need to serve static files such as images, .js files, and .css files.
What it's bad for
Of course, Node is not the ideal choice in some situations. Here are scenarios where Node would not excel:
Dynamically created pages
Currently, Node doesn't provide a default way to create dynamic pages. For example, when using JavaServer Pages (JSP) technology you can create an index.jsp page that contains loops in JSP snippets like <% for (int i=0; i<20; i++) { } %>. Node doesn't enable these types of dynamic HTML-driven pages. Again, Node isn't ideally suited to be a web page server, as Apache and Tomcat are. Therefore, if you wanted to provide a server-side solution for this in Node, you'd have to code the entire solution yourself. A PHP programmer wouldn't want to program a PHP converter for Apache every time they deployed a web application, but at this point, that's what Node would require you to do.
Relational database heavy applications
Node is designed to be fast, asynchronous, and non-blocking. Databases don't necessarily share these goals. They are synchronous and blocking, as calls to the database on writes and reads block until a result is generated. So, a web application that requires a lot of database calls, a lot of reads, and a lot of writes with every request would be a bad match for Node, since the relational database itself would be negating many of the strengths of Node. (The new NoSQL databases are a better match for Node, but that's another topic entirely.)
Node accomplishes its goals of providing highly scalable servers. It doesn't allocate a thread-per-connection model, but instead uses a process-per-connection model, creating only the memory that is required for each connection. It uses an extremely fast JavaScript engine from Google, the V8 engine. It uses an event-driven design to keep code minimal and easy-to-read. All of these factors lead to Node's desired goal — it's relatively easy to write a massively scalable solution.
http://www.ibm.com/developerworks/opensource/library/os-nodejs/index.html
发表评论
-
5个让人激动的Java项目
2012-04-09 10:33 839原文地址:http://sd.csdn.n ... -
bootstrap Designed for everyone, everywhere.
2012-03-13 13:33 1027Bootstrap, from Twitter Simple ... -
开源播放器VLC
2012-02-21 09:25 1202原文地址:http://news.csdn.net/a/201 ... -
使用 Spring Batch 构建企业级批处理应用 第 1 部分
2012-02-19 22:51 2001原文地址:http://www.ibm.c ... -
Tumblr:150亿月浏览量背后的架构挑战(上)
2012-02-19 22:05 1082原文地址http://highscalabil ... -
pdf.js html5展现pdf
2012-02-08 09:24 3945Quite amazing: PDF.js is a Java ... -
Redis 和 memcached
2012-02-07 10:38 2534原文地址:http://www.ibm.com/develop ... -
jQuery UI vs Kendo UI
2012-01-31 09:30 2970原文地址:http://jqueryuivskendoui.c ... -
what is activemq
2011-12-29 10:10 1127原文地址:http://www.christianposta. ... -
jerry jquery in java
2011-12-20 11:15 914Jerry is a jQuery in Java. Jerr ... -
activejdbc 多加关注。。。
2011-07-22 13:18 1246官方网站:http://code.google.com/p/a ... -
Processing 进行数据可视化
2011-07-01 11:00 1437虽然很多开源项目的初衷都是为现有的应用程序构建替代方案,但是仍 ... -
Processing 进行数据可视化
2011-07-01 10:59 1095虽然很多开源项目的初衷都是为现有的应用程序构建替代方案,但是仍 ... -
POI VS JXL
2011-06-27 13:53 1578I think for your purposes eithe ... -
pdf.js html5展现pdf
2011-06-17 09:43 7595查看了这个项目的官方demo,效果还不是很满意。持续关注中 h ... -
Thrift vs. Protocol Buffers
2011-05-08 11:06 771http://floatingsun.net/articles ... -
java bean Validation
2011-03-25 17:06 784http://www.ibm.com/developerwor ... -
java html parser
2011-03-23 09:38 858java的html 解析器: jsoup:http://www ... -
WebDav
2011-01-05 14:54 1857原文:http://www.iteye.com/topic/6 ... -
NFC
2010-12-08 09:11 10411、NFC与BLUETOOTH比较 http://zh.wik ...
相关推荐
Node.js 应用程序是用 JavaScript 编写的,可以在 Mac OS X、Windows 和 Linux 上的 Node.js 运行时中运行而无需更改。 Node.js 应用程序旨在最大限度地提高吞吐量和效率,使用非阻塞 I/O 和异步事件。Node.js 应用...
Node.js 应用程序是用 JavaScript 编写的,可以在 Mac OS X、Windows 和 Linux 上的 Node.js 运行时中运行而无需更改。 Node.js 应用程序旨在最大限度地提高吞吐量和效率,使用非阻塞 I/O 和异步事件。Node.js 应用...
Node.js 是一个开源、跨平台的 JavaScript 运行环境,它允许开发者在服务器端执行 JavaScript 代码。Node.js 使用 V8 引擎,这是 Google 为 Chrome 浏览器开发的高性能 JavaScript 和 WebAssembly 引擎。Node.js 的...
Node.js 是一个基于 JavaScript 的服务器端运行平台,允许开发者使用 JavaScript 语言来编写服务器端应用程序。 Node.js 的出现使得 JavaScript 成为服务器端脚本语言。 Node.js 的主要特点是非阻塞 I/O 和事件驱动...
Full Stack Javascript - Learn Backbone.js, Node.js and MongoDB (APress 2015).epub Learning Node.js for Mobile Application Development (Packt 2015).pdf Microsoft Press Node.js for .NET Developers (2015...
Node.js 是一个开源、跨平台的 JavaScript 运行环境,它让开发者可以在服务器端执行 JavaScript 代码。Node.js 使用了 Google V8 引擎,这个引擎是为 Chrome 浏览器设计的,因此 Node.js 具有高性能和高效性的特点。...
Node.js 应用程序是用 JavaScript 编写的,可以在 Mac OS X、Windows 和 Linux 上的 Node.js 运行时中运行而无需更改。 Node.js 应用程序旨在最大限度地提高吞吐量和效率,使用非阻塞 I/O 和异步事件。Node.js 应用...
标题中的“Node.js-Node.js for Mobile Apps”指的是将Node.js环境移植到移动设备上,使得开发者能够在Android和iOS平台上直接运行Node.js应用程序。这一技术的出现极大地拓展了JavaScript的适用范围,不再局限于Web...
Node.js 应用程序是用 JavaScript 编写的,可以在 Mac OS X、Windows 和 Linux 上的 Node.js 运行时中运行而无需更改。 Node.js 应用程序旨在最大限度地提高吞吐量和效率,使用非阻塞 I/O 和异步事件。Node.js 应用...
Node.js 应用程序是用 JavaScript 编写的,可以在 Mac OS X、Windows 和 Linux 上的 Node.js 运行时中运行而无需更改。 Node.js 应用程序旨在最大限度地提高吞吐量和效率,使用非阻塞 I/O 和异步事件。Node.js 应用...
Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境,它允许开发者在服务器端使用 JavaScript 进行编程。v14.17.3 是 Node.js 的一个稳定版本,针对 x64(64位)架构设计。集成的 npm (Node Package Manager)...
Node.js是一种开源、跨平台的JavaScript运行环境,它允许开发者在服务器端运行JavaScript代码,极大地扩展了JavaScript的应用领域。Node.js基于Chrome V8引擎,因此它具有高性能和高效的特性。标题提到的是Node.js的...
Node.js 应用程序是用 JavaScript 编写的,可以在 Mac OS X、Windows 和 Linux 上的 Node.js 运行时中运行而无需更改。 Node.js 应用程序旨在最大限度地提高吞吐量和效率,使用非阻塞 I/O 和异步事件。Node.js 应用...
Node.js 应用程序是用 JavaScript 编写的,可以在 Mac OS X、Windows 和 Linux 上的 Node.js 运行时中运行而无需更改。 Node.js 应用程序旨在最大限度地提高吞吐量和效率,使用非阻塞 I/O 和异步事件。Node.js 应用...
Node.js 应用程序是用 JavaScript 编写的,可以在 Mac OS X、Windows 和 Linux 上的 Node.js 运行时中运行而无需更改。 Node.js 应用程序旨在最大限度地提高吞吐量和效率,使用非阻塞 I/O 和异步事件。Node.js 应用...
From this book you will learn how to write maintainable server-side JavaScript using Node.js, how to test your code and deploy it on the internet. Table of Contents Chapter 1: Setting up for Node.js...
Node.js是一个Javascript运行环境(runtime environment),发布于2009年5月,由Ryan Dahl开发,实质是对Chrome V8引擎进行了封装。Node.js对一些特殊用例进行优化,提供替代的API,使得V8在非浏览器环境下运行得更好...
Node.js 应用程序是用 JavaScript 编写的,可以在 Mac OS X、Windows 和 Linux 上的 Node.js 运行时中运行而无需更改。 Node.js 应用程序旨在最大限度地提高吞吐量和效率,使用非阻塞 I/O 和异步事件。Node.js 应用...
Node.js是一个基于V8引擎的开源、跨平台的JavaScript运行环境,用于执行JavaScript代码。它允许开发者使用JavaScript编写服务器端应用程序,使得前后端语言统一,提高开发效率。Node.js提供了一个非阻塞I/O模型,使...
Node.js 应用程序是用 JavaScript 编写的,可以在 Mac OS X、Windows 和 Linux 上的 Node.js 运行时中运行而无需更改。 Node.js 应用程序旨在最大限度地提高吞吐量和效率,使用非阻塞 I/O 和异步事件。Node.js 应用...