7. Apr. 2009

The Time to live (TTL)s occuring  in the Domain Name System (DNS), where they are set by an authoritative nameserver for a particular resource record can help us speeding up domain transfers rfom one server to another.

When a caching (recursive) nameserver queries the authoritative nameserver for a resource record, it will cache that record for the time (in seconds) specified by the TTL. If a stub resolver queries the caching nameserver for the same record before the TTL has expired, the caching server will simply reply with the already cached resource record rather than retrieve it from the authoritative nameserver again.

This is a service intended to speed up DNS queries and to prevent load issues on authoritative nameservers. Therefore shorter TTLs can cause heavier loads on an authoritative nameserver, but can be useful when changing the address of critical services like web servers or MX records, and therefore are often lowered by the DNS administrator prior to a service being moved, in order to minimize disruptions.

And this is exactly what we can use to speed up the transfer time of our domain to move. At least a day before the big bang to happens we enter our Hosting Panel trilling down to the DNS section within and lower the TTL for each relevant definition within the definitions of the domain in question.

The units used are seconds. A common TTL value for DNS is 86400 seconds, which is 24 hours. A TTL value of 86400 would mean that if a DNS record was changed, DNS servers around the world could still be showing the old value from their cache for up to 24 hours after the change.

Lowering it should be done with some respect about the idea behind and therefore the new value does not really should be close to 1 or so, but going with 600 for a day will for sure not harm.

When we now change the nameserver entry within our Registrar’s Service, all old values will get invalidated within 10 minutes and the new authoritative nameserver will get asked instead.

So all the traffic should then get routed over to the new server in a blink and the higher value there for the TTL will propagate again through the World Wide Web.

2. Feb. 2009

So you have a wonderful java-servlet and you have a stable and reasonable fast application server like tomcat? But sometimes you have performance breakdowns.

  • Sometimes the application seems to be frozen.
  • Sometimes you just want to know what the hell
    is going on with your application.

So the best way is to say:
“Please my little tomcat, tell me how do you feel right now?”

And if you choose the right method you will get some answers.
The good news ahead it isn’t very difficult to get the information.

You just have to enable the tomcat console. And furthermore you should enable the printout of the garbage collects.
(type “java -X” to get the right gc options for your java-version – normally something like verbose:gc. I will show you in detail in another article)

Just edit the tomcat-users.xml File.

You have to add the roles: manager and admin and add a user and a password that meets your needs. Invent your own username and password and keep it secret. Because userid and password are not encrypted (if you do not explicitly configure https as protocol) you should keep in mind that this is no high sophisticated security.

Tomcat Monitoring

Nevertheless – save your tomcat-users.xml file and restart tomcat. If your tomcat listens on the standard port (8080) give the manager console a try:

http://yourserver-adress:8080/manager/html

You will be prompted for a username and password – if you can remember the values you had put in the tomcat-user.xml file – go on and put them in. So you can see the console – not very exciting – thats true. Here you can just see how many sessions are currently active in an application . And if you want to have fun and you are !not the responsible person for this service you can easily stop an application within the tomcat.

But to be more serious now choose the link in the upper right corner (Server Status) and again the link in the upper right corner (Complete Server Status).
Or just enter:

http://yourserver-adress:8080/manager/status/all

Take some time to explore the page. Reload the page several times ñ look at how the connections fall and rise. Don’t forget to check the Memory is enough free memory left ? What is the state of the connections ñ are there any connections left. How many threads are busy? How many spare threads do you have? Perhaps you have to adjust the values in the server.conf file.

Can you imagine that it is very easy to get this values extracted and in a “cvs”-file on a regular basis ? So you can get historical values – But that is subject for an own article.

22. Dec. 2008

Living in a world of GUIs (Graphical User Interface) many people are no longer aware about what SQL can do. Recently a friend asked me about, is it possible to extract the email adresses of my registered user out of my Joomla? Sure it is!

It is not even difficult and the idea behind was to load them into some email list to send out season greeting to all subscribers. To keep it simple here I will explain it by using a more common wordpress example, but in principle it can be done for any data the same way.

Most email clients are able to import a CSV (Comma separated List of Values) File by default, as also Excel or Access will ‘eat’ them without problems.

Now we have to invoke the MySQL Command Line Client or any other tool which enables us to execute a  SQL Statement hopefully we will ending up with such a prompt:

mysql>

There we first tell MySQL  to work with the specific database in question.

mysql> use DATABASE     (e.q   use wordpress)

With the command desc we can get a field description of our table.

mysql> desc TABLENAME   (e.q.  desc wp_users)

Knowing about the table structure now, with select we can extract the data wished:

mysql> select user_nicename as Name,user_email as Email from wp_users;
+——-+———————+
| Name  | Email               |
+——-+———————+
| admin | admin@localhost.com |
+——-+———————+
1 row in set (0.00 sec)

Seeing the output and being sure about the result will match our needs we are now finally going to spool the query result into a file:

mysql> select user_nicename,user_email into outfile ‘c:/temp/u_emails.csv’ fields terminated by ‘;’ from wp_users;
Query OK, 1 row affected (0.01 sec)

Content of “c:/temp/u_email.csv”:

admin;admin@localhost.com

or as variation:

mysql> select user_nicename,user_email into outfile ‘c:/temp/u_emails.txt’ fields enclosed by ‘”‘ terminated by ‘;’ from wp_users;
Query OK, 1 row affected (0.01 sec)

Content of “c:/temp/u_email.csv”:

“admin”;”admin@localhost.com”

And now it should be easy for you to import all emails addresses within your email client’s address book.

next »