Showing posts with label Ruby. Show all posts
Showing posts with label Ruby. Show all posts

Sunday, May 25, 2008

J2EE vs Ruby

Rails and a typical J2EE Web stack

The Rails stack to a typical J2EE Web stack comprised of the Tomcat servlet container, the Struts Web application framework, and the Hibernate persistence framework.



Comparison of Rails and J2EE stacks

As you can see, the fundamental difference between the Rails stack and the components that make up a common J2EE-based Web application is small. Both have a container in which the application code will execute; an MVC framework that helps to separate the application's model, view, and control; and a mechanism to persist data.Reference

Sunday, April 20, 2008

clear session files - Ruby

Session is important for web application as track user. Session grow likely same as log files. This will cause memory overhead. We can clear session using Linux crontab command.

This will remove 300 minutes old session files by every day 00:10 hrs.

Place this command in the crontab file in the /usr/bin/ directroy.

Can edit the crontab file using following command.

crontab -e

* * * * * find absolute_path -name 'sess.*' -amin +300 -exec rm -rf {} \;
Explanation:
10 0 * * * find /home/tmp -name 'ruby_sess.*' -amin +300 -exec rm -rf {} \;

find - find the file that start with the name sess.

min +300
- find the session file with 300 minutes old

exec rm -rf - execute the command remove the files which is 300 minutes old.