Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Jul 272011
 

Calculating the max client in Nginx

Answer:

If you use Nginx as a web server, the max. number of client can be served at the same time by Nginx should be calculated by the following formula:

max_clients = worker_processes * worker_connections

But this does not equal to the number of users can be served at the same time by Nginx, since a lot of browsers open 2 connections to the web server at the same time.

Jul 252011
 

List all git config options

Answer:

To show the current git global options, you can use the command "git config --list"

# git config --list

user.name=John Doe
[email protected]
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=auto
color.ui=true
color.pager=true
..
Jul 232011
 

Check the amount of memory used by PHP

Answer:

To check the amount of memory used by PHP process, use the function - memory_get_usage

E.g.

// Returns the amount of memory, in bytes, that's currently being allocated to your PHP script.
echo memory_get_usage(); 
Jul 212011
 

Update an existing document in MongoDB

Answer:

In an given collection, if you want to perform update on an existing document, the easiest way is to use the following commands.

employee = db.employees.findOne( { name : "Peter" } );
employee.position = "Project Manager";
db.employees.save( employee );

Done.