classxrange(object) | xrange([start,] stop[, step]) -> xrange object | | Like range(), but instead of returning a list, returns an object that | generates the numbers in the range on demand. For looping, this is | slightly faster than range() and more memory efficient.
Posted onEdited onWord count in article: 810Reading time ≈1 mins.
This article will tell you how to build a website in ubuntu system. First you should install apache and php. These two tools can help you to build a small website, like “hello world” websit:D
// run the following commands
sudo apt-get install apache2 php5 libapache2-mod-php5
/etc/init.d/apache2 restart
important path
Then you should remember the following paths:
/etc/init.d/apache2
/var/www
/etc/apache2/apache2.conf
/etc/apache2/conf.d
/etc/apache2/sites-enabled
Apache’s default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d
Test your php
1
vi /var/www/hello.php
1 2 3
<?php phpinfo(); ?>
Then call this file in browser (http://localhost/hello.php)
DONE:D
Posted onEdited onWord count in article: 2.1kReading time ≈2 mins.
Today, I use jstack, jmap, and resin to look up why my server is deading in stress test. And I also find printing information into log is useful. You can print log in entrance of function and exit of function.
jstack is a tool which is looked up stack of system, specailly in threads. It is mainly for looking up dead lock and some functions which are executed too slowly.
jmap is a tool which is looked up current memory of system or some memery jvm can not delete immediately.
You can use jstack like this:
1
jstack -l [pid]
If you know pid of the process, you can see what’s the situation of stacks in process. If you want to see the detail, looking at those stacks.
jmap is used like this:
1
jmap -heap [pid]
Today, Big niu Qiao tells me about JVM GC policy.
There are New Generation, Old Generate and Perm Generation in JVM. You can find them in jmap command. And New Generation are new objects. And Old Generation are old objects which are still be refered. Eden Space stores new generate objects. And From Space stores still alive objects after gc once. To space stores objects which are not refered and in From space before gc once. If an objects is in From Space many times, it will be moved to Old Generation by JVM. Perm Generation are static objects and Classes.
By the way, if your application runs in resin, you should look up those logs of resin, for example, jvm-default.log. The log file contains GC log information. If GC throws overMemory exception, you should modify your configuration of resin (resin.xml in resin4.0+). Modify or add: