Node.JS: Removing unnecessary MongoDB files - node.js

I have written a Node.JS application that I will have to ship soon, in the form of an RPM (RedHat Package Manager), with everything included (Node, CSS, JS, MongoDB, Node modules, etc.) The total application weights about 60MB compressed, of which about 50MB comes from MongoDB. I would like to reduce the size of the final shipment.
Now, as far as I'm concerned, my Node.JS application only explicitly executes mongod. Looking at the mongodb-linux-i686-2.2.2/bin directory I see about a dozen executables, most of which weight 10.3MB (that's a little curious that so many weight 10.3MB), such as bsondump, mongodump, mongoexport, mongofiles, mongoimport, etc.
Which MongoDB executables are being run under the hood in my "standard" (single database, no sharding, nothing fancy) Node.JS application? Which can I remove for the final shipment?

Only mongod would be required in that scenario.

It might not be legal to create your own distribution of the MongoDB server. See http://www.mongodb.org/about/licensing/ and I would also ask http://www.10gen.com directly for clarification.

Related

Use of node js to search contents on an in-memory file on 100000 PCs

There is a network of around 100000 PCs, each of which contains an in-memory XML file whose contents I need to search from a central server. This XML file is generated by a windows service that runs on each PC.
The search query is generated at the central server, propagated to each of the PCs on the network, and if information in the in-memory XML matches the search query, then the list of all matching PCs needs to be sent back to the server and results displayed in 20 seconds or less.
In view of the scalability and concurrency requirements, I am planning to utilize node js to solve this problem. But I've never used node js before. Could someone on this forum please guide me how to architect a solution to this using node js? The 100000 PCs are spread across more than 50 LANs. I've been reading up a lot about socket.io and other stuff about node js, but can't figure out a solution to this. Could someone please guide me? Which node package can help me to read an in-memory XML file? If something changes on a PC's in-memory file while a user is viewing results about it on the server, those changes as well need to be updated in real time on the result viewer. Apart from node js, is there anything else using which I could get this done?
Use Express for NodeJs. It's a webserver, so you can issue HTTP commands to it https://expressjs.com/

Server segregation of nodejs and mongo in amazon

Why there are single web service just for mongodb? Unlike LAMP, I will just install everything on my ec2. So now I'm deploying MEAN stack, should I seperate mongodb and my node server? I'm confused. I don't see any limitation mixing node with mongod under one single instance, I can use tools like mongolab as well.
Ultimately it depends how much load you expect your application to have and whether or not you care about redundancy.
With mongo and node you can install everything on one instance. When you start scaling the first separation is to separate the application from the database. Often its easier to set everything up that way especially if you know you will have the load to require it.

is there any reason not to install a second instance of MongoDB?

I already have mongoDB on my mac (OS mavericks) because it comes packaged with Meteor. I'm learning some pure, non-Meteor node.js right now. I'd like to work with mongoDB, but I'm afraid to change any of the configuration I've already got on my machine, as I don't want to screw up the Mongo that comes packaged with Meteor.
Is this something I should be concerned about? How do I protect my other mongo instance?
I assume by the MongoDB that comes with Meteor you mean the MongoDB database Meteor uses internally when you type "meteor" and that resides in .meteor inside your app folder. In that case it's no problem adding a MongoDB installation to the OS, they won't conflict.
In fact, I recommend to separately install MongoDB for different reasons. When you are running a production app it's easier to scale, let multiple apps use the same database etc.
First install MongoDB, for example with Homebrew. Then you just run your app with
MONGO_URL=mongodb://127.0.0.1/<db> meteor
According to mongodb's documentation:
...In many cases running multiple instances of mongod on a single system is not recommended but for testing purposes of course possible.
I don't think that meteor has done intensive configuration changes to mongodb's out-of-the-box configuration (except of course if you've done already configuration amendments for special sharding, Oplog tailing strategies etc.)

Target domain of node.js

I am just wondering how node.js is compared to other frameworks. Is it possible to develop rich internet applications using node.js? How is it compared to java NIO?
In short I am looking for the target domain of Node.js
not sure why there are people voting to close this question when I think it's perfectly viable, Node.JS is a new server side framework that is still undergoing heavy development.
to answer your question may be a little difficult for myself as I know nothing of Java, but I know a little about Node and use it on a regular basis whilst it's under development.
Node JS is basically a framework built up of several components that are built for speed, such as Google's Javascript Engine (V8), it was originally designed for Google Chrome but released as an Open Source project.
Many developers have taken V8 and placed it on the server, combining it with custom libraries integrated into V8 to allow File I/O and network access.
So what is Node.JS
Node JS is basically Googles V8 javascript engine as the language platform, Mixed in with Lib Event, which is a technique of using 1 thread to perform multiple tasks by creating Events from the kernel.
The primary usage of Node it's it's networking functionality, Ryan has contributed a really powerful HTTP Library that has helped it take of with Web Services, which is what it's main intention is for.
Why do I use NodeJS
I like Node JS simply because it's easy, fast and very modular, being able to supply information such as Files, Images, Text to a web browser directly from the Servers Memory (RAM) in under 10 lines simply helps understand the power behind it.
For instance, Nearly every web-browser makes a request for favicon.ico, which is usually ~10KB, Now if i had 100 Requests per second and every request was requesting my favicon, my hard drive would have to locate that file, blocking all other reads in the mean time.
I can just load the data, store it within a variable and send it to every client much much faster then the traditional methods.
What's the best part about Node.JS
The best part about node.js personally is the concept, the idea of being able to search thousands of clients concurrently without blocking any other client is the drive behind the speed, every thing is speed motivated, hence Google V8, it's called V8 for a reason, Lib Event, it's removes the requirement for loads of threads, which can be heavy on resources.
Getting Started
I seems like you have not really had a play with Node.JS, and if you have not then is suggest you isntall it and have a play for a few days, Join there IRC Chat and speak to some of the guys over there, there is usually a member of the immediate team there that will help you.
You can simply install node.JS on Ubuntu like so (In Bash):
if you do not have git
sudo apt-get install git-core
install node JS:
cd /etc/
sudo git clone git://github.com/joyent/node.git
cd node
sudo ./configure
sudo make
sudo make install
to test make sure you have it installed
node --version
if you get the version your ready to go, go to your home directy
cd ~/
mkdir Nodes
cd Nodes/
create a simple file in you ~/Nodes Directory called test.js and start away, you can run the code lie so:
cd ~/Nodes
node test.js
I had written that small guide to setting NodeJS up not just for yourself but for others who may read this and would like to set things up.

Node Js how to get started

I'm a newbie JavaScript programmer who wants to experiment with server side JavaScript using Node.Js on my Mac
I downloaded NodeJs and the wizard installed it, but now I can't see it in my applications?
1) How do I open it and start using it? Do I do it from the command line? if so, how do I start?
2) Can I connect it to a MySQL database I have installed with MAMP?
Thanks if you can help
To start node, you open a terminal and type:
/path/to/node scriptname.js
Depending on how you installed node, the actual location of node may vary. You should figure that out. You should probably add that path to your PATH environment variable. If you do this then you can simply type
node scriptname.js
There are plenty of samples around the net. As for mysql connectivity, check this out.
I am in pretty much in the same boat as you are, and I highly recommend you to watch the meetup talk by Ryan Dahl on http://nodejs.org/
It is only about an hour long, but it pretty shows you how you can use it for your own non-blocking applications.
In terms of driver for accessing SQL, you will need to install NPM http://npmjs.org/
You can do a quick search http://search.npmjs.org/, on the support for MySQL. Because node.js is still relatively new to the scene, you will see quite a bit of choices competing to meet your goal

Resources