Clustering Node JS in Heavy Traffic Production Environment

I have a web service handling http requests to redirect to specific URLs. Right the CPU is hammered at about 5 million hits per day, but I need to scale it up to handle 20 million plus. This is a production environment so I am a little apprehensive about the new Node Cluster method b/c it is still listed as experimental. I need suggestions on how to cluster Node on handle the traffic on a linu

重交通生产环境中的节点JS聚类

我有一个Web服务处理http请求重定向到特定的URL。 正确的CPU每天大约有500万次点击,但我需要扩展到2000万。 这是一个生产环境,所以我对新的节点群集方法B / C仍然列为实验性的有点担心。 我需要关于如何在节点上处理Linux服务器上的流量的建议。 有什么想法吗? 每天500万相当于每秒57.87,而2500万是每秒289.4。 对于您的情况,这些数字对于单个服务器来说不算太多。 如果你只想重定向特定的url,你可以选择更适合于

chat from a webpage, (XMPP? Strophe? Punjab?)

I would like to implement FB-chat inside a webpage . I looked around in Facebook API, i found out that chat is allowed only using XMPP. First I tried to connect to FB-chat using Pidgin and it worked fine. My conclusion was that FB-chat server is acting as the XMPP server. Is this true? I read about XMPP, it seems that an open TCP connection should be established between the client and the s

从网页聊天,(XMPP?Strophe?Punjab?)

我想在网页中实现FB聊天 。 我环顾了Facebook API,发现只允许使用XMPP进行聊天。 首先,我尝试使用Pidgin连接到FB聊天,它工作正常。 我的结论是,FB聊天服务器充当XMPP服务器。 这是真的? 我读到了XMPP,似乎应该在客户端和服务器之间建立一个开放的TCP连接,以交换从网站(通过JavaScript和无插件)无法实现的XML节,因为只有http请求/响应可以交换,没有TCP连接。 这意味着它们之间应该存在某种代理,而对于身份验证

Using <keygen> to get an RSA key for use with javascript?

I need an RSA key pair for my web project and while there are some libraries I think it would be a good idea to rely on the browser (for security and speed) to generate the key for me. Is it possible to use keygen or something an other browser API to do so? I don't know how to get the keys from keygen. They seem to be generated on submit, but I don't want to send them to the server.

使用<keygen>获得RSA密钥以用于JavaScript?

我需要一个用于我的Web项目的RSA密钥对,虽然有一些库,但我认为依靠浏览器(安全性和速度)为我生成密钥是一个好主意。 是否有可能使用keygen或其他浏览器API来做到这一点? 我不知道如何从keygen获取密钥。 它们似乎是在提交时生成的,但我不想将它们发送到服务器。 您可能正在寻找的东西就像Mozilla的DOMCrypt API提议。 它允许你通过window.mozCrypto.pk.generateKeypair()生成一个密钥对( window.mozCrypto应该稍后

Node.js on multi

Node.js looks interesting, BUT I must miss something - isn't Node.js tuned only to run on a single process and thread? Then how does it scale for multi-core CPUs and multi-CPU servers? After all, it is all great to make fast as possible single-thread server, but for high loads I would want to use several CPUs. And the same goes for making applications faster - seems today the way is use m

多节点上的Node.js

Node.js看起来很有趣, 但我必须错过一些东西 - 是不是Node.js只能在单个进程和线程上运行? 那么它对于多核CPU和多CPU服务器的规模如何? 毕竟,尽可能快地构建单线程服务器非常棒,但对于高负载,我想要使用多个CPU。 同样的道理是让应用程序更快 - 看来今天的方式是使用多个CPU并行执行任务。 Node.js如何适合这张图片? 它的想法是以某种方式分配多个实例或什么? [本帖最新截至2012年9月2日(比上述更新)]。 No

Has Node.js Abstarcted that multithreading?

Hey Guys , I am new to Node.js and have a doubt to clear ... My question is when node js is single threaded and non blocking tel me about this scenario. Like When client1 sends a request to get the data from DB to the main thread of Node , Node assigns the task to the thread pool and say the T1 thread from the thread pool will be executing that task by accessing the data from DB.... Lets at th

Node.js是否突破了多线程?

嘿伙计们,我是Node.js的新手,有疑问可以清除... 我的问题是,何时节点js是单线程的,并且无法阻止有关此场景的电话。 就像client1向DB的主线程发送从数据库获取数据的请求一样,Node将任务分配给线程池,并且说线程池中的T1线程将通过访问DB中的数据来执行该任务。 。同时又让另一个客户端说client2从DB向主线程请求一些数据,并且节点也把这个任务分配给线程池,所以T2也会去同一个DB来获取数据,但是T1还没有完成访问数据

Node js API in production server

I need to run node.js API which saved in Production server. In local server, it works perfectly but in live it show error that 'site cant be reached'. We are using server Linux apache of godaddy. Node.js is successfully installed in server.I am using Putty as terminal in windows. I dont know why this happen when it comes to live. No error in code. Is there any changes need to URL t

生产服务器中的节点js API

我需要运行保存在生产服务器中的node.js API。 在本地服务器中,它可以很好地工作,但在现场显示“无法访问网站”的错误。 我们使用godaddy的服务器Linux apache 。 Node.js已成功安装在server.I在Windows中使用Putty作为终端。 我不知道为什么会发生这种情况。 代码没有错误。 我们运行的URL是否需要更改? 并在邮递员测试结果。 基本代码如下,我用“127.0.0.0.1:3000”测试它的URL(不起作用)。 我用服务器IP,系统IP

Determining number of callback functions JS

Number of callbacks? In the following code which creates a simple http server, am i correct in saying that this code has two callback functions, which are: http.createServer(function(req,res))... server.listen(port, function()..

确定回调函数JS的数量

回调数量? 在下面的代码中创建一个简单的http服务器,我是否正确地说这个代码有两个回调函数,它们是: http.createServer(功能(REQ,RES))... server.listen(port,function()..

Save a very big CSV to mongoDB using mongoose

I have a CSV file containing more than 200'000 rows. I need to save it to MongoDB. If I try a for loop, Node will run out of memory. fs.readFile('data.txt', function(err, data) { if (err) throw err; data.split('n'); for (var i = 0; i < data.length, i += 1) { var row = data[i].split(','); var obj = { /* The object to save */ } var entry = new Entry(obj); entry.

用mongoose保存非常大的CSV到mongoDB

我有一个包含200,000多行的CSV文件。 我需要将它保存到MongoDB。 如果我尝试for循环,Node将耗尽内存。 fs.readFile('data.txt', function(err, data) { if (err) throw err; data.split('n'); for (var i = 0; i < data.length, i += 1) { var row = data[i].split(','); var obj = { /* The object to save */ } var entry = new Entry(obj); entry.save(function(err) { if (err) thro

Node.js: Count the number of lines in a file

I have large text files, which range between 30MB and 10GB . How can I count the number of lines in a file using Node.js ? I have these limitations: The entire file does not need to be written to memory A child process is not required to perform the task solution without using wc: var i; var count = 0; require('fs').createReadStream(process.argv[2]) .on('data', function(chunk) { f

Node.js:计算文件中的行数

我有大的文本文件,其范围在30MB到10GB之间。 如何使用Node.js文件中的行数? 我有这些限制: 整个文件不需要写入内存 子进程不需要执行任务 解决方案不使用wc: var i; var count = 0; require('fs').createReadStream(process.argv[2]) .on('data', function(chunk) { for (i=0; i < chunk.length; ++i) if (chunk[i] == 10) count++; }) .on('end', function() { console.log(count); });

Read a text file using Node.js?

I need to pass in a text file in the terminal and then read the data from it, how can I do this? node server.js file.txt How do I pass in the path from the terminal, how do I read that on the other side? You'll want to use the process.argv array to access the command-line arguments to get the filename and the FileSystem module (fs) to read the file. For example: // Make sure we got a fi

使用Node.js读取文本文件?

我需要在终端传递一个文本文件,然后从中读取数据,我该怎么做? node server.js file.txt 我如何通过终端的路径,我怎么读取另一端? 您需要使用process.argv数组来访问命令行参数以获取文件名和文件系统模块(fs)来读取文件。 例如: // Make sure we got a filename on the command line. if (process.argv.length < 3) { console.log('Usage: node ' + process.argv[1] + ' FILENAME'); process.exit(1); } //