View Poll Results: a better platform?
- 3. You may not vote on this poll
Results 1 to 2 of 2
Thread: Servlet vs PHP
- 07-04-2008, 11:43 AM #1Member
- Join Date
- Jul 2008
- Rep Power
Servlet vs PHP
We have to build an online automatic system for evaluating c,c++,java programs for an online programming contest. We feel that the system will be faster if we use a servlet based system rather than a PHP based system though our team is more comfortable with PHP. The database in any case will be MySQL. We feel that a servlet based system can help us pool our database connections and will open up multiple threads rather than processes as in PHP. The system will involve a presentation layer for accepting the files and update the database. When the files get uploaded a system is triggered by RMI to check the files and inserts the scores in the database. A script can periodically update the ranks and create a static page with the ranks. A similar system is also possible in PHP. But which is more favourable platform? servlet or php? Is it possible that with one connections in one class I can handle all the db queries in servlet? Is this advisible? How can we optimize the system for speed more?
- 07-09-2008, 11:08 PM #2
I naturally optomize for time-domain criticality
I suggest a Sevlet based approach, Connection Pooling is just one of a Coffee Plantation of built-in ( not drop in ) that lends to scalablitiy. In paticular, it is possible to do programmatic approaches ( with Java ) that are traditionally proven using an API that has parallelization exposed to the coder. While some may feel that is not a proveable basis for your design assesment, we can expect that counter-claims would be substantiated with hand-tweaked one-off designs run on powerful racks. Scriplet based approaches are definitely do-able, I have near-zero experience with any scripting language, but I am as of this moment writing a JSP, which amounts to a scriplet that calls a Servlet.
The Servlet is paged in once in Tomcat. There is a call to init() when the code is brought in from persistent register. ( fancy name for disc ) After that, the Server just puts a new Thread on the entry()Java Code:
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
What we do to make Logging time efficient is have page ranks, domaing tracking or whatever be passed to a dedicated thread that does nothing but Buffering Logging. It sorta gets mildly sophisticated, traditionally is considered system programming beyond the domain of the every companies' coder, but so-far / so-good ~ I loaded a project in NetBeans a few days ago and the only thing if found in several hundred lines of code was the semicolon I had not removed prototyping my SessionMaster, I had skipped out on short notice to load NetBeans.
Everything I have tried to program in seems to be already coded into Tomcat. I expect they will already have logging running on it's own buffer space.
Just the way I would do it, with stuff I have not thought of yet already working .....
message edit: Java can do NUMEROUS database access protocols. Recently I have begun to think one basis for the design of Java was to provide a uniform call paradigm such that database access could be made better by having a layer between the actual code that calls the db vis-a-vis the coder's view of what is going on. Database everything is all through Java, and as well something like constructing a URL is built in to the Libs,....
I had someone ask me a question about threading recently, when I looked at the code it had a switch that could translate the call to fit any of five or six database call string syntax fomats. These were very common names we hear often.
Java Practices -> Get database connection
Java Database Connectivity - Wikipedia, the free encyclopedia
Java: Database Connection Pooling with Tomcat
Last edited by Nicholas Jordan; 07-10-2008 at 12:25 AM. Reason: mySQL + JNDC + JDBC + so on....Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- By kondalrao.p in forum Java ServletReplies: 1Last Post: 09-06-2008, 01:10 PM
- By banie in forum New To JavaReplies: 6Last Post: 04-11-2008, 05:18 PM
- By ravian in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 12-03-2007, 04:00 PM
- By Swamipsn in forum Java ServletReplies: 1Last Post: 08-08-2007, 12:57 AM
- By osval in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 03:47 PM