Link to home
Start Free TrialLog in
Avatar of mindgardener
mindgardenerFlag for United States of America

asked on

Startup company - need to decide webservice architecture. Java or Php webservice ?


Hi all,

I am working on a startup company, and this is a decision we are trying to solve.

Java webservice or php webservice ?

We will have a web UI which will be written in html, javascript. Then, our business logic - we want to have as webservice which can be called by the UI.  There is mobile verison - iPhone, iPad, Android version for this website. And we want to use the same webservice to be called by all these devices. Database we are going for mysql.

We are using Amazon EC2. Webservice is to be hosted in the amazon cloud. Scalability and performance is going to be key in our application.

Now, the question is what is the best approach for webservice development. I got opinion for Php and to use CakePhp or CodeIgnitor Php. Then, someone else mentioned to me about Ruby On Rails.

Also, there is opinion that java is better in terms of scalability and stability, and will help in long run than using php for webservice.  

While scalability is important, we also want to consider the fact that we are a startup and have to get the product at the earliest.

I know this is going to trigger a discussion. More than links, I would appreciate if you can give me some solid points on which language to choose, and pros/cons for them, and if you can give me some use case on how you dealt this with situation of choosing the right webservice.

I am in charge to make the decision. Please give me some insights on this, so I can make the best decision on this.

Thanks,
SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Wasim Akram Shaik
Wasim Akram Shaik
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mindgardener

ASKER


Thanks everyone for the inputs..I had a word with CEO of our startup, and he said as the head for technology for the company, I have the decision power on this. He said, choose the technology based on what is best for the company and long term scaling and performance, and not on the resource. Just tell him what technology we are using, and we will get the resource to work on it.

One of my other team member is java person. I know java myself. So, I am kind of leaning more towards using java webservice for the startup backend. Good choice ?

The question is - is there any light weight java webservice framework to go for ? especially for MVC. Should I introduce persistance layer now, or keep it later ?

@crazedsanity - I have a question for you. The UI that runs javascript/html/css will make REST calls to this webservice, and in future version, API calls from Smartphone/Tablet native apps, then gmail browser plugin, facebook apps, etc). If team have equal resource strength for Java and Php, do you think php would be a better choice than java here ?  You mentioned PostgreSQL as a good choice. Is it good choice if I have analytics to run on it ? Is PostgreSQL and Java a good combination. There is payment module involved (customer making orders, etc), and then dashboards that will show revenue/other matrix reports. So, there is some heavy DB work to be involved here. You think PostgreSQL will be a better choice than MySQL in this ?

I can't say for certain that PHP is better than Java, as I have no experience with Java.  PHP is fast, there's no time required for loading, which makes development faster (I think Java requires some compiling, not sure though).  Anything that speeds development makes time-to-market much faster.

As for PostgreSQL, again I can't say anything as far as Java goes. But I can say with absolute confidence that PostgreSQL will scale an order of magnitude better than MySQL.  Database transactions are incredibly important, and the ability to combine schema and data changes within a transaction that can be rolled back is a MASSIVE benefit; so far, I know of NO OTHER DBMS that will handle schema changes within a transaction.  

PostgreSQL will scale pretty massively.  On one particular deployment, which was a SaaS (Software as a Service) system, we used PostgreSQL.  We had several databases, the smallest of which housed 30 million records (compressed data-only dump was several gigs).  All queries ran in sub-millisecond speed, with hardware that wasn't super high-end.  We did a stress test and managed to get 75,000 web-based transactions in under a second, and the server didn't break a sweat (the load average was virtually untouched).
You ask -> "light weight java webservice framework to go for ?", there are several Pre-Made and tested frameworks, I have heard of "Apache Axis2", which I was told was quite versatile for request data services, not sure if it's lightweight. But there are many factors in choosing your development set up, and you don't give much info on the specs needed, not that this question was about that. So you may want to get that sort of advice in another specific question about that in the java area.
Since you know Java, you may want to go with that, for me a disadvantage of java server side, is there are not many host companies that offer java setups. There is not as many software packages available for java as there are for php, because of the number of users.
I really agree with crazedsanity, I think that the PostgreSQL is better than MySQL for larger growing server side data storage, but like with PHP versus java, this does not mean that MySQL is not good.
Just for discussion consideration? What kind of opinion that you might get here would set you on a course to use PHP, or to use java. As I said there are advantages and disadvantages to each, and the web developer has more to do with a great working site, than the platform (IMHO).

@crazedsanity - I am buying the point about PostgreSQL and put this option to the team for final decision. Let me see what they give on it.

@Slick812 - I was looking the option of which webservice to take (java or php) if I have resource for both of them..From the discussion above, I see that java would be a more stable option, as there is resource for the development. With that, I got the answer for the main question of php or java. I am deciding with java webservice.

Just for a discussion, would the guys here also give me some info the framework I can use for java.
That would make the answer fully complete and I can start the development work.

I know that usually frameworks takes lot of space and memory. And initial setup time is also long. I need something that is a good framework, while I can quickly get the REST webservice running. We have payment module through web, and we do online transactions. Will the framework by default support transaction and persistence, or should I add it from outside ? If I am not giving too much of info  - our product would have a combination of similar stuff of webs.com, groupon, yelp, job posting, etc. I am attaching a diagram of how the stack will look like. Let me know if you would need any additional info to help me with the right choice..
ee.jpg
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Hi dpearson -

Thanks for the info. If I use mySQL now, at what point should I think of a db change...I put to my team on PostgreSQL, and they asked the exact question you asked - about DBA resourcing and development tools.

Lets see on this..I think by end of this week, we will make the final decision. I will keep all the points for our above decision.

Thanks all for the inputs.  
@dpearson: I'm curious as to where you get the figures for availability of DBA's experienced in MySQL versus PostgreSQL?  I would be interested to read that.

Someone that is experienced with either MySQL or PostgreSQL should find the transition quite easy.  In fact, someone with a background in MySQL would probably find the transition to PostgreSQL much simpler than the inverse: PostgreSQL is fully transactional, so it's like having all the tables setup as InnoDB.  There is no change in SQL, so as long as your DBA is actually qualified with SQL, understands how to properly build scalable databases and can properly implement normalization and efficient indexes, it shouldn't matter to them which DBMS is used (so starting with the more powerful one just makes sense).
Both MySQL and PostgreSQL could be used, but the actual SQL for either is identical or almost so, there are many practical aspects to all programming choices, besides the code used. I feel like PostgreSQL is better for larger deployments, but I can not really define what size would amount to a "Larger".
@mindgardener, You asked about a "need something that is a good framework", You have not gotten any reply that I can see. Just trying to offer a suggestion, I have seen and asked questions that are too "general", and do not give a place to begin, if I were asking this sort of question, I would do some preliminary research, and get the names of four java frameworks that seemed to be along the lines of what is needed. And ask which one of the four may be best suited for my endeavor. This way, there is some foundation for the type of framework you may be talking about ( I could not get much of what sort of framework you may be referring too, a base or programming framework, or a MCV like php joomla). And also gives experts a way to not recommend their favorite, if it is not appropriate to your needs. Still for responses to that question you may need to post a New question in the Java area.
From your ee.jpg of your process stack, I can see you have a full and large service platform planed, larger than I had thought you were doing before I saw that.
A worthwhile DBA won't care what the underlying technology is.  If they can't work with MySQL, PostgreSQL, and even MSSQL (or "Microsoft SQL Server"), then they don't actually have the necessary experience.

So back to the DBMS itself: PostgreSQL can, in the same transaction:
 * change schema across multiple tables
 * drop/create/modify indexes & primary/foreign keys
 * alter stored procedures
 * alter data

If that transaction is rolled-back, ALL CHANGES WITHIN THE TRANSACTION ROLL BACK TOO.  In MySQL, parts (or possibly all) of a transaction can and will affect the database even if it's rolled back.  If for no other reason, THAT makes PostgreSQL the winner.
Avatar of dpearson
dpearson

@crazedsanity I think we're talking about a different sort of DBA role.  You're thinking in terms of the SQL layer itself - which certainly any competent DBA will be only too happy to work with any modern database (MySQL, PostgreSQL, Oracle and MSSQL).

What I'm talking about is the layer below that - tuning the actual database engine itself.  This for me is where the DBA really earns their pay.  They need to know the details of how precisely how each specific engine (within a given database - e.g.MySQL supports about 4 or 5 of these) lays out its files, manages memory and buffer spaces, when and how commits to disk occur etc.  This sort of stuff is completely different between each database and any DBA who tells you he is an expert in all databases at this level is smoking something illegal.

At the SQL level the DBA isn't the only expert available (your Java devs should all know SQL to varying levels and can help with query tuning).  But down in the guts of the engine, the DBA Is your only expert and they can easily get 10-100x performance improvements from that layer (which translates to 10-100x reduced cost for your databases).

It's here that you want to be drawing from a wide and deep pool.  And for MySQL and Oracle that pool is huge.  For PostgreSQL it's much smaller (and MSSQL perhaps mid sized).  The bigger the pool then the better the talent you can find (given a fixed budget and time frame to hire people).

Again this doesn't mean you should never choose Postgres - it's just you need to be aware of what you're giving up by making that choice.  (So you should definitely need the benefits that Postgres brings before incurring the cost).

Doug
@dpearson: I don't think it would take a lot to become comfortable with that layer... but having the knowledge "going in" can make a lot of difference. Point taken.
Thanks everyone for the inputs. This discussion has been really informative.

We decided to go with java webservice and mySQL database. For webservice, we designed a Spring/Hibernate structure, that is custom design to meet our requirement.

Thanks for all the inputs.

Mind Gardener