Finding a host provider
Where to start when selecting a host provider for a java based web application? Some time ago I started doing some research on the topic. One of the options would be direct hosting of a grails web application by the cloudfoundry.com. A nice blog by Marcel Overdijk describes this. This is however a bit more expensive (roughtly $75 a month) than a vps (starting at $20+ a month). Another option would be google app engine. My impression is that this however will take some time to further mature.
At Grails.org there is a nice overview of hosting providers. This blog and comments showed valuable information. On the grails mailing list the following names kept popping up (initial impression in braces):
- Eapps.com (nice overview)
- DailyRazor.com (very attractive)
- KgbInternet.com (Keith is raved)
- Vpslink.com (looks nice)
- ThePlanet.com (free if you provide a great idea)
Starting at around $20-22 per month (250 Mb).
Finally I selected eapps.com. Reasons: it was recommended to me by a fellow enthusiast at a nlgug meetup, it was on my short list, good reviews, their support pages are helpful (mentioned grails), they are in business since 1996. The nice thing about a provider in the US that their office-hours are my evening hours.
Tip: If you know a nice grails website just use whois to find out who-is hosting.
Creating the account
After experimenting with some home virtual linux servers (virtualbox.org) it was time to take the plunge. On Friday evening I registered for an account at www.eapps.com. I selected a Linux VPS with 432 Mb memory. Postings already mentioned that 250 Mb is the minimum for running Grails apps.
After 10 mins I already received a call to verify my account details: "I am looking for B....". My acount would be live in 5 minutes... Now that's fast. It indeed popup up at the servers administration page. Using the experience from configuring Linux servers at home I had my first grails application live within 2 hours after the account request.
Installing applications
From the web-application page I selected to install the following applications:
- Apache (webserver)
- Tomcat 6 + mod_jk plugin (webserver for java web applications).
- Mysql 5
- Groovy + Grails (didn't expect that one).
- Subversion (get my code from the repository)
Configuring
I changed the MySql configuration to use InnoDB engine to support transactions. Adding the following line to /etc/my.cnf in section [mysqld] does the trick:
default_storage_engine = InnoDB
More information can be found on the mysql support page.
Adjust /opt/tomcat6/conf/tomcat-users.xml to change the default (so easy to guess) password.
Accessing the Tomcat server via the Apache webserver is done by the mod_jk plugin as described over here. After some time I finally figured out that I just had to add one line to grails web-application accessible via www.agiletrackingtool.com/mysecret. (mysecret are other 'secret' characters known to those one joining for early testing).
Once the mod_jk configuration is working you can disable tomcat listening to port 8080 so the tomcat server can not be accessed directly from the outside (/opt/tomcat6/conf/server.xml):
<!-- commented out
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
Tomcat JNDI
Update March 24: The issue seems to be fixed using this solution. No broken Mysql connections this morning.
Update March 23: The Mysql brokken connection issue is still present. Even after setting 'autoReconnect=true'. The next step will be checking out this advise. Any help or suggestions are welcome! Very unpleasant issue...
connectionTimeout="20000"
redirectPort="8443" />
-->
Tomcat JNDI
Update March 24: The issue seems to be fixed using this solution. No broken Mysql connections this morning.
Update March 23: The Mysql brokken connection issue is still present. Even after setting 'autoReconnect=true'. The next step will be checking out this advise. Any help or suggestions are welcome! Very unpleasant issue...
Update March 21: After the web site is not used for a longer time a mysql connection error is reported (see issue). I tried to resolve the issue by configuring jndi on tomcat. Adjust (/opt/tomcat6/conf/context.xml) and and the "Resource" section:
<Context>
....
..
<Resource name="jdbc/agiletracking"
auth="Container"
type="javax.sql.DataSource"
username="mysecret"
password="also"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/agiletracking?autoReconnect=true"
maxActive="100"
maxIdle="8"/>
auth="Container"
type="javax.sql.DataSource"
username="mysecret"
password="also"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/agiletracking?autoReconnect=true"
maxActive="100"
maxIdle="8"/>
..
...
</Context>
production {
dataSource {
dbCreate = "update"
jndiName = "java:comp/env/jdbc/agiletracking"
}
}
Also make sure that /opt/tomcat6/lib contains the mysql-connector-java.jar (already installed by eapps.com).
Update Jan 2011: Interestig link on how to configure mysql timeout on Dzone using DataSource.groovy (see comment).
Tomcat memory
By default tomcat is configured to use 64 Mb. Performance however dramatically increased when setting it to the recommended maximum size of 192 Mb in /etc/tomcat6/tomcat.conf):
# Initial Java Heap Size (in MB)
wrapper.java.initmemory=192
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=192
wrapper.java.initmemory=192
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=192
This gives a great performance boots. With 64 Mb my web application was much slower as compared to running it on my local machine. With 192 Mb the performance feels much snappier.
When idle Tomcat says:
Free memory: 110.83 MB Total memory: 185.62 MB Max memory: 185.62 Mb.
The Linux memory use ('free -m') shows:
total used free
Mem (Mb): 432 299 132
Mem (Mb): 432 299 132
Deployment of your grails war file is simple done by copying your file (sftp) to '/opt/tomcat6/webapps' and restarting tomcat.
That's it. Configuring my web-application on a vps turned out to be quite smooth going. Over time more settings will be tuned (mysql database size), but this proved to be a nice start.
Updated with additional info on JNDI configuration.
BeantwoordenVerwijderenHi,
BeantwoordenVerwijderenGreat post. Actually I'm starting a grails application and I followed all the steps successfully (it's not always that easy with internet posts), including purchasing a VPS at eapps!
Did you definitely solve the "broken Mysql connections problem" with the march 24th update?
Regards.
Hi OrÁCuLO,
BeantwoordenVerwijderenThe broken mysql connection problem does no longer occur.
Kind regards,
Ben
Linux supported different platform. You can easy to handle the server. It's allocated space is very high compare to windows hosting. Windows hosting Cpanel access is very tough.website hosting
BeantwoordenVerwijderenweb hosting
Linux hosting is really better then window hosting because Linux hosting has more feature comparing window hosting.Register Domain
BeantwoordenVerwijderendomain registration india
Hi,
BeantwoordenVerwijderenthanks for sharing your opinion. I would like to tell you that i am taking Linux hosting and Java hosting services from Net4 and I love the Linux hosting because it is more reliable and secure as compare to windows hosting.
Glad to visit this professional blog... I would love to learn more and more about technical and programming related things.. Great work! cheapest domain registration india
BeantwoordenVerwijderenYour blog is brilliant here.As it explains more things about its topic.Really too knowledgeable content is presented.Thanks for this post.
BeantwoordenVerwijderenweb designing company
Actually linux operating system supports different platforms. You can do web designing using linux and it is very easy to use Linux Web Hosting.
BeantwoordenVerwijderenIts very informative...... i think linux hosting is best.....
BeantwoordenVerwijderenHi ! this is nice article. i am always suggest you to choose Vps Server. Because this is best and gives maximum performance.
BeantwoordenVerwijderenThanks
I want to say that this post is astonishing, nice written and comprise about all important info’s. I would like to see more posts like this.
BeantwoordenVerwijderenlinux vps
The blog post is astounding for selecting a host provider which helps in improving website efficiency in all means like maximum uptime, bandwidth etc.
BeantwoordenVerwijderenYour blogs and its stuff magnetize me to return again n again. Compila secure email providers
BeantwoordenVerwijderenWhether you’re a beginning webmaster or a more experienced digital business owner, you need a dependable customer support. Things can and will go wrong on your website’s backend, but getting support when you need it can go a long way toward minimizing any potential damage to your business.
BeantwoordenVerwijderenDomain Registration Bangalore
Hi,
BeantwoordenVerwijderenI like your post very much as it contains very useful information that helps in one's real life situations.
Cheap hosting
Heys i was looking for Linux web hosting in india , as well as low cost web hosting.
BeantwoordenVerwijderenany suggestions
Appreciate you guys you are doing a really terrific job.
BeantwoordenVerwijderenLearn More About Kinken Hikaku
Real Hosting Reviews is the best place to find top hosting companies reviews in India and enlist in front of you to make your decision easy.These companies can be considered being most dependable and the cheapest web site hosting organizations.
BeantwoordenVerwijderenhosting review | web host reviews
Wow! It is an excellent post. I was checking continuously this blog, and I am impressed! Here you discuss the Linux VPS it's a really very good information for me. Because I want to host my business, it helps of legal rights and permission, a website can become a unique. Some days before I found a site mywindowshosting.com is a best window hosting site, and It provides verity types of hosting. Thanks a lot.........................
BeantwoordenVerwijderenThanks for sharing this information here, Superb blog and informative post you have shared.. iPage review
BeantwoordenVerwijderenVery nice post! I really appreciate your work. Good to know about the topic wish to know more about cloud servers. keep it up :-)
BeantwoordenVerwijderenDeze reactie is verwijderd door de auteur.
BeantwoordenVerwijderenDeze reactie is verwijderd door een blogbeheerder.
BeantwoordenVerwijderenAmazing Blog! You share really very useful information about VPS hosting. Thanks for sharing such good information with us.
BeantwoordenVerwijderenThanks for sharing this incredible and unique content. This would help many like me in getting the Ipage hosting
BeantwoordenVerwijderenIncredible post and very infiormative points you havee shared about this concept. free domain registration
BeantwoordenVerwijderenThank you for the helpful post. I found your blog with Google and I will start following. Hope to see new blogs soon
BeantwoordenVerwijderenlinux vps hosting
I appreciate your effort for providing such useful and informative article, Thank you for updating. Snap our tags to know more about VPS server.
BeantwoordenVerwijderenWeb Hosting companies in India | VPS Hosting India | VPS Hosting Plans | VPS Hosting companies India
Deze reactie is verwijderd door de auteur.
BeantwoordenVerwijderenthis post are enlightening in Classified Submission Site List India . An obligation of thankfulness is all together for sharing this outline, Actually I found on various domains and after that continued with this site so I discovered this is hugely improved and related.
BeantwoordenVerwijderenhttps://myseokhazana.com/
Also read about 9 Scientific Facts In The Quran That Will Surprise You
BeantwoordenVerwijderenWhat are the benefits of Munakka
BeantwoordenVerwijderen