Has anyone used Lua to build a web application? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I come from a Java and PHP background to build web applications.
Has anyone used Lua before to build a web applications?
Question: If so, what are the pro's & con's of using Lua versus PHP or Java for a web application? (e.g. web server support, performance, code maintenance, etc).

As others mentioned Lua is "do it yourself" kind of environment. Also it is very fast and quite memory efficient compared to Perl/PHP/Python/Ruby especially if you are using LuaJIT. And it is very easy to integrate with C/C++ code. Usually these points are irrelevant for a typical web application where performance is usually restricted by database. Also where you don't really care about C/C++ integration and where you don't really want to do things yourself but rather you want to build on top of existing frameworks. For this reason I don't think Lua is a good fit for a typical web applications. At the same time there are some niche applications where Lua shines. For example our company specializes at building high performance HTTP servers used for adserving. So what we are using is our own HTTP server written from scratch in C++ which integrates Lua as a scripting language for our business logic. This allows us to do customization of the business logic in Lua quickly compared to what we had to do if it was pure C++. At the same time we always have an option to do performance critical parts in C++. If we were using any other scripting language we are positive it would be slower, it would use more memory and generally would be harder to integrate with C++ code. At the same time we don't really care much about loss of extensive library support were we using other scripting languages as the domain we are working in is quite specialized so usually those libraries are irrelevant for it anyway.

I am using Lua right now to build a web application! Whatever happened to software developers that "do it yourself" got a bad name - too lazy, weaned on bloated megabytes of support libraries, or what? In reality, as others have pointed out, there is decent support, just not on the scale of Python, say. Lua is by far the fastest scripting language (especially with www.luajit.org around), and much, much cleaner as a language design than any other in its league out there. This is vital for long-term maintenance.
For those using lighttpd as their webserver (me included), the added bonus is that the full power of Lua is available for mod_magnet scripts, useful for synchronous request handling/rewriting-on-steroids.

I have programmed a few websites with Lua. The first one was a raid planner for my World of Warcraft guild (that's often how you start programming in Lua...). I used mod_lua with an alpha version of Apache 2.4 for that. Two others were small contests sites for customers, developed with WSAPI, Nginx, Spawn-fcgi and Orbit. This setup is damn fast, faster than mod_lua and anything else I have seen. The pages would display instantly as if they were in cache ! The experience was very pleasant and Lua makes you quickly productive. But you better be well organized. Lua is missing a lot of batteries when it comes to web development, so you often have to implement your own and it can become messy. So I suggest you plan what you will need before you start. I used my own Lua "ORM" with MySQL and a forked version of Lua Pages for the templates. Have a look here if you want to give Lua+Wsapi+Nginx a try : http://mascarenhas.github.com/2009/10/24/wsapi-nginx-fcgi.html
I think it is the best setup.

There are quite a few projects using Lua for web development.
For example, Nanoki, an HTTP and wiki engine developed in pure Lua.
Or Sputnik, which is build on top of Kepler.
That said, Lua is very much a, hmmm, "do it yourself" kind of environment.

Pros: fast, small, elegant, easy to make your own binding to a C library.
Cons: sometimes you have to write your own libraries for things you would get for free in Python.
http://luanova.org/ has a number of good posts on web development in Lua.

We use lua with great success for our backend implementation. You can also have a look at JUCI webgui for embedded devices. It uses lua for backend implementation. You can have a look at how code interacts with lua/C backend: https://github.com/mkschreder/juci
Note however that this backend is a pure jsonrpc backend so it does not create any html like php or cgi pages. Lua is perfect if all you do is handle and respond to json requests. You can also have main application in php and use lua to write the application on the backend. Or main application completely in javascript.
I think that if you are going to use lua in places where you want to generate html then you will find it lacking many features, but if you limit it to purely functional backend implementation then you will find that it works very well.

lighttpd and mod_magnet are really great platform, but I recommend that you first take a look at Kepler Project. It's a quite great beginning.
You can take your PHP/Java background useful.

Related

Restful web application, Java or PHP? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm creating an Android application which will access data using a restful web application.
I have quite a lot of experience with Java, but minimal experience with PHP.
Having looked online, it is difficult to determine which language is more suitable, scalable, portable etc.
I'm hoping that the Application may one day have many concurrent users and therefore I need the most suitable option.
If anyone has any experience writing a web application in either language, I'd be really interested to hear about your experiences, and any problems you faced.. i.e. for a java web application do you need a tomcat server or another embeddded to server for it to be able to run?
Thanks, for any answers, Matt.
If you already have experience with java, I would suggest you use the following to build your REST services: http://restlet.com/
Its very easy, and efficient. The performance is very smooth. For PHP, you will have some learning curve, and also there is no standard. Mixing java with PHP is like combining a VERY STRICT LANGUAGE (java) with a VERY LENIENT LANGUAGE (PHP). So its safer to be on the same language.
Tutorials:
Official tutorials to get started: http://restlet.com/learn/tutorial/2.2/
Good step by step tutorial with screenshots and code snippets: http://java.dzone.com/articles/restlet-framework-hello-world
Short:
Take JAVA!
Always choose the language you are comfortable with. Also I think Java is better suited in the end.
PHP isn't my favorit. Most of the people like it, because it is easy to start with. (It was also for me the second (non Browser) language I touched.)
Framework Tips
WebFrontend: Play Framework
Back End&Scaleability: AKKA
JSON: Gson
Long:
Scaleability in the meaning to scale to lots of concurrent users:,
is more a architectonical issue, as a question for the right language. You can write scaleable software in any language. The difference isn't the scaleability of a language, but it could be the performance. One language will take longer for the same task as the other one. But you could always throw more Servers in, to scale out.
Architectures to consider if you want to scale out, are in my opinion message based designs. My favorite is the actor model, there is a very good framework for that in Java, the akka framework (production proved). But I think you first should get your software running. If you get enough users... scalability problems are the problems you like to have (they mean you have users).
Scaleable doesn't only mean, that you can scale to many concurrent users. But the ability, to handle the complexity of the software or can handle concurrent development and so on (your team will grow, thats also a problem to handle). In this topics Java is as clearly static typed OOP language, better suited.
Also the performance will not be as good as in Java (it is a interpreted language). But there are always options. Facebook started with PHP. In an interview one of the lead developers, told that PHP isn't that scaleable, because PHP wasn't designed for OOP. But the performance issue was handled, through writing a compiler for PHP (outputs C++). [If if find the link I will post it] .
Update the PHP Compiler is Called HipHop and it uses HHVM (Hiphop virtual machine), Facebook developed it after excessive CPU usage
You can consider looking at https://jersey.java.net/ As a web container you can use anything like Tomcat. I have used Google App Engine in the past.
To get started quickly with Java look into http://dropwizard.io/, using less EE frameworks and more standard Java.
Has Jersey for REST and is supereasy to run.

Ruby on Rails vs Grails vs. Spring ROO vs. Spring App [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm planning on writing a simple web application that will be used by lots of users (as complicated as a simple bookmarking app) and I'm trying to decide which framework/language to use.
I'm very experienced with Spring/Hibernate and Java in general but new to both Grails and RoR (and Spring ROO).
The only reason I'm considering RoR is because Java hosting is MUCH more expensive than RoR hosting (which is supported by almost any hosting vendor for 5$ per month).
Assuming the price wasn't an issue, which one of the frameworks/languages mentioned above would you recommend for a Java developer (who knows how to configure Spring/Hibernate etc.)?
I'm afraid that by using RoR I won't be able to easily support many users who are using the website at the same time.
thanks
First you can have a look to these related questions :
Rails or Grails?
Learning Ruby on Rails any good for Grails?
https://stackoverflow.com/questions/1283935/what-technology-asp-php-joomla-rails-grails-for-a-website-from-scratch
Is Grails worth it?
Is Grails (now) worth it?
Now, I will try to answer you according to your requirements you have communicated and the information I have gathered from the internet and my own experience.
Ruby on Rails
I do not advice you to start with RoR because you are a Java developer and you will have to learn a new language (Ruby) and a new environment (Rails). The hosting issue is not a real issue. You can have a VPS hosting plan for $10 (www.enjoyvps.com) perfectly suited for small grails app. If you application needs more memory, you might need to add another 10 Bucks.
If you hosting is really THE critical factor, go with Python/Django or PHP/Kohanna (a very good MVC framework). Otherwise, according to your background, Grails is more suited for you than Rails.
Grails
Few months ago, I had the same dilemma as yours and I decided to have my way with Grails. Why?
Because it's cool !! I mean, community is very helpful and dynamic, Groovy is a pleasure to develop with (be careful : thereafter , there are good chances that you will loath Java). Also, it is a state-of-the-art framework based on very-well established technologies (Hibernate, Spring, Java) and hence, it can improve considerably your market value as a developer. Grails is my favorite
Spring Roo
Roo is Grails for Java. So if you don't want to learn Groovy and if you need pure Java application (that will always run faster than a Groovy-based app), go with it. The community is smaller than Grails but the project is supported by SpringSource who is quite active in the community. I think that if you want to go as fast as possible, this is the solution for you.
Spring Application
You should choose this option only if you don't like Spring Roo integrated technologies (Hibernate, JSP, Maven...) and you want Java absolutely. Otherwise, there is no interest (except for educational purposes) of spending hours of configuration and tuning when you can build sophisticated enterprise applications in a best-practice manner within minutes (with Rails, Roo or Grails).
Each of the options above will provide you enough performance for the application you want to build. A lot depends on best practices for website applications like good architecture design, correct usage of caching strategies and requests optimization...
My Bottom Line
If you have some time to spend for learning new concepts (Groovy, RAD...), go with Grails. If not, go with Roo. Forget about Spring App and Rails.
If hosting is THE issue, so go with Python/Django. You can deploy on GAE, it's free scalable, performant and you will deal with the same concepts as Rails or Grails.
I don't understand the obsession with runtime performance. Given your scenario your primary focus should be on your performance, as in your ability to get things done with the chosen technology.
You will get more done in a given period of time with Groovy than with Java any day. Often one line of Groovy code will equate to 10 lines of Java code etc etc
Very rarely will byte code execution time be your performance issue, most often its...
Bad algorithm implementation or design.
Bad DB design and / or queries
Taking to long to get things done and then having all sorts of commercial relationship issues because of it.
With web applications you are usually not performing lots of long running CPU bound operations. Most of your request / response time is spent in the wire (internet routing etc) and in the DB (executing queries).
Choose a technology that takes a load off your mind and one that frees you from writing mountains of boiler plate code, so that you can rather concentrate on designing and implementing good algorithms, DB's and queries etc etc
Id personally choose Grails.
I chose Roo over Grails and Rails at my company. Runtime performance, easy debugging, nice Eclipse integration (it's plain old Java after all), no "black magic" happening at runtime. In fact, there is no Roo runtime library needed to run a Roo app, just the library dependencies like Hibernate and AspectJ. You can look at the code that is generated so you know exactly what is going on. Also a biggie for me is that Google has chosen Roo as the preferred tool for creating GWT apps going forward and they are throwing their support behind it. I have been extremely impressed with Roo thus far, I think it will be the tool of choice in the near future.
Performance issues with RoR are going to be caused more by the $5 hosting plan than by the choice of language and framework. Consider Heroku for your hosting, as you can start cheap / free, and then scale up as needed.
For a simple bookmark app, however, Rails is probably overkill. Take a look at the Sinatra framework as well, as you weigh your options.
Have you looked at Gaelyk? http://gaelyk.appspot.com/
It's a lightweight Groovy framework for Google App Engine
I know this post is a bit old. It's 2012 now and Spring Roo just released version 1.2.2 3 months back.
I'm a Java developer & has just started an ambitious project that will see me launching a web application for wide adoption. I'm going through Spring Roo & is getting my hands dirty. My first impressions are nice, but when I read over the Internet about it being a good framework for fast prototyping and only for developing CRUD operations etc. I feel a bit demotivated to use it.
But I personally think that Spring Roo (SP) gets my project started with best practices already implemented with the choice of files created which I can use as template for custom use. Obviously, I'm not afraid to code. We will always have to code ourselves, I don't want any "magic".
I also tried to look around the RoR scene and is easily intimidated by the learning curve involved.
I don't see much traction in the Spring Roo community. Is there any specific reason for it?
Also are there any better alternatives? I'm a bit confused over my decision of finalizing a framework that is both robust and scalable in future. I don't want to be a position where Twitter is now where 2 years worth of RoR code makes them re-think their choice of RoR. Is Spring Roo the best bet for me?

what is faster flex and Java or flex and php?

We are designing a major webapplication for the www.
It a social community site. And I would like to know witch direction I need to take.
What works faster, flex and php or java and flex?
I've read that flex and php with amfphp is very fast (with AMFEXT).
But I have seen that 90% of the major companies here in Europe are hiring java / flex developers to develop major webapplications.
Our application needs to handle a lot of users at the same time.
Our application will be hosted in a datacenter later it will be hosted by a major cdn provider.
Our application has a video (streaming and progressive streaming) a shoppingmall and a community area.
Due to the nature of our business model we think that our application will attract a lot of users a day.
So we must have a webapplication that works very fast. With a strong technology on the backend. Java or PHP (amf support)
for the Database:
We will start with mySql and make the switch to oracle and then to sas.
What is the right direction for our application?
flex and java or flex and php?
I have no idea which provides "faster" execution - however, I do know that "faster" isn't the only reason to choose a language. Here's a general comparison of Java and PHP and here's another that compares Java, PHP and Ruby on Rails - neither one focuses on the language executing "faster".
Especially with Flex - you will most likely spend more time executing in Flex rather than in the backing server side language. Also, since the application is Flex - it should be possible to provide similar test implementations in PHP and Java and compare the results for your specific application.
The biggest part of the choice would be whatever language and platform your developers are familiar with.
This is a pretty subjective question. I believe that PHP tends to be a little bit faster but it really sort of depends on your applications requirements. From personal experience, I have been able to get more done with less code with PHP. Java has a much more strictly enforced object oriented approach which is actually quite nice whereas PHP is still lacking a bit in this area. For the most part, you will be able to accomplish the same things with both languages. I also feel that PHP has much better community driven support then Java which could be a factor. It really all depends on what you guys are most comfortable with. Both languages play well with Flash/Flex.
Java is faster than PHP in terms of pure execution time. Here is an interesting algorithm performance comparison that ranks a number of languages, showing Java to be approximately 300 times faster than PHP:
http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/
With that said, this is NOT a good approximation of the speed differences for real-world applications. A major bottleneck will typically be your database. However if your application requires a lot of processing that doesn't occur in the database, you may see performance improvement with Java.
One advantage in terms of remoting is that Adobe offers Blaze DS which is a standard implementation of AMF for Flex. They also include some messaging capabilities ("data push") which I don't believe are implemented in AMFPHP.
Language choice is largely (though not entirely) irrelevant in terms of speed. Very large deployments have been built on both, and the speed factor comes from good architecture and code. So whether you go with php or java, hopefully there are good architects/designers/developers versed in the ways of writing for performance involved.
Java is always going to be faster than PHP, unless you have done something very wrong!
BUT...
The speed of the server side script won't really be noticed by the user, because so many other things add to the time it takes to get a response from the server (network delay, propagation delay, etc). To the user PHP and Java will seem equally fast.
To the server, however, there is a difference. According to your post you plan to have many concurrent users. If each user takes 20% longer to complete a request with PHP, then PHP can handle 20% fewer concurrent users. So if you worry that the server will fill up and run at maximum capacity, then I would pick Java. If you don't expect that to happen for quite a while, then I would pick PHP, based solely on performance.
Of course there are other things to take into account, like what you can do with each language, libraries available, developers available to/how well you know each one.
I would also strongly advice against changing anything backend once the system is up and running. If you start out with MySQL, don't change to Oracle half way. Either stick to MySQL, unless it becomes impossible, or start using Oracle from the beginning.
I would say, try both by doing a prototype ( e.g 3-4 pages ) for each language, and run a few performance test , overall should not take more than one week to do these.
Each language has its own pros / cons.

.Net vs Java Jobs [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
When I do a job search for a .Net developer it's all mostly the same stuff .Net, ASP, SQL Server, CSS, Javascript, AJAX, and maybe C#. Whereas with Java you may have to have Java, Sturts, Spring, JSF, EJB, a RDMB, Eclipse RCP, CSS, Javascript, AJAX, Rest, any number of specific Java APIs. Is it easier to be a .Net developer since the technologies are so focused? Or does it just seem that way?
It's different, rather than easier.
The reason the Java jobs are listed against frameworks is becuase Java has tons of frameworks and design patterns ready to be used to make things easier to maintain. The design patterns and frameworks are starting to appear more in .NET now too, so expect to see jobs changing to look more like those Java jobs.
There are just as many patterns and practices in both worlds - but they are more established in the Java community (the Java employer will push them onto you, you will find yourself pushing your .NET employer).
Largely, Java vs .NET is syntax. Do either (do both!). But be aware of the patterns and frameworks as they'll really help you to write better code.
I'm a C# developer, believe me, there are more choices in Java than in .Net. The obvious advantage in .Net, though, is that in any job you land uses the same IDE (Visual Studio) and (in most cases) uses the latest .Net framework (except for maintaining legacy apps). There may be some subtle differences in different employers such as them using Enterprise Libraries, MVC versus Forms, WPF, etc.; But if you're a seasoned C# developer, you can adapt easily depending on your fundamentals.
Some developers in my field who did not learn any other programming languages tend to be lazy and simply drag-n-drop objects to accomplish tasks 80% of the time (some of them even believe that object-oriented programming is simply code with objects). If you are familiar in C++ or any C based language, you will definitely have the upper hand but that is not a requirement.
I'd suggest learn the best programming practices, never put all your eggs in one basket (even though god did that to us men), and be open to other languages other than C#. If you learn one C-based language, learning other major languages won't be as hard rather than starting with VB.Net.
Either way, both of them are well paying jobs and you won't regret if you choose either one.
my 2 cents.
Yes, with Java you have web frameworks like JSF, Struts, Struts2, Wicket, SpringMVC, Stripes, Tepestry, Facelets .. just to name a few. Every company is using different frameworks, so if you change job you will learn new frameworks. And its only web framework, what about persistance ? JDBC, Hibernate, JDO, iBatis. Who can name 5 mocking frameworks for Java? Who have used 5 different application servers? What about databases? Ive even used Informix and Teradata. I think all .NET is using Sql Server and its easier to learn one database well.
Please don't forget about the following .NET technologies: Win.Forms, Silverlight, WCF, WPF, WWF... There are still a lot of learning in .NET outside of web development. It is not easy to be a senior .NET developer, at least not much easier then Java. However, IMHO it is easier to start in .NET when you have no past development experience.
In Java world, you develop with technologies from many communities, in .NET world, you only work on technologies from Microsoft. In my opinion Java developers are more free in terms of choices of technologies, but sometimes it also brings you problems. :)
Java itself has more fields coming into it; I mean, Java developers have now more opportunities than any other technologies in the market. They are being hired at attractive compensations to develop different java-based applications, software and games etc. It will continue to be increased in future as well. Just stick with JAVA :)
Let's line up the technologies you mention (and some you don't). This will necessarily be somewhat imprecise so will be a nitpickers paradise :)
.NET Java The overall encompassing technology
ASP Struts A Web development framework
JSF
(.NET BCL?) Spring An application development framework
EJB
SQL Server an RDBMS A database
(VS) Eclipse An IDE
CSS, Javascript, AJAX, REST are all technologies common to both stacks.
The technology concepts you have to learn are the same whatever stack you choose - it's just the names are different. The .NET ones will all be 'Microsoft Blah Blah Blah', whereas the Java ones will all have funky cool names...
Something else important to consider is that you can get "branded" as a .NET or Java developer midway into your career. At that point, it becomes more difficult to switch, since (understandably) you have less experience in the one you didn't choose. Thus far, I have been alternating, but that comes with its own set of problems where you have gaps in experience with new libraries/frameworks on each side.
Any other thoughts on the pros/cons of developing Java vs. .NET? For instance, what types of companies, cultures, pay, etc?
For me, it seems like .NET tends to be in more established companies whereas Java is used by a lot of startups (given the low cost entry and open source libraries available). The pay is comparable, but .NET seems a little higher. Java development might be a little more fun given that you get to play with new frameworks more often and aren't as restricted to specific paradigms.
In talking with my .Net pals, it seems like getting started on something pretty standard is easier, because most people do things the Microsoft way. Java's large number of choices means you have to pick libraries and toolkits at many different levels. The upside for Java is that when the official or common way doesn't suit you, there are a lot more options available.
In practice, I don't think it makes much difference. Any single Java shop will generally settle on one particular thing. E.g., Struts or Spring or JSF, not all three. Hibernate or Ibatis or pure JDBC, not all three. So I think there's about the same amount of stuff to learn, in that whether you're using a Java stack or a .Net one, you're still solving roughly similar problems.

Choosing Java vs Python on Google App Engine

Currently Google App Engine supports both Python & Java. Java support is less mature. However, Java seems to have a longer list of libraries and especially support for Java bytecode regardless of the languages used to write that code. Which language will give better performance and more power? Please advise. Thank you!
Edit:
http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine?pli=1
Edit:
By "power" I mean better expandability and inclusion of available libraries outside the framework. Python allows only pure Python libraries, though.
I'm biased (being a Python expert but pretty rusty in Java) but I think the Python runtime of GAE is currently more advanced and better developed than the Java runtime -- the former has had one extra year to develop and mature, after all.
How things will proceed going forward is of course hard to predict -- demand is probably stronger on the Java side (especially since it's not just about Java, but other languages perched on top of the JVM too, so it's THE way to run e.g. PHP or Ruby code on App Engine); the Python App Engine team however does have the advantage of having on board Guido van Rossum, the inventor of Python and an amazingly strong engineer.
In terms of flexibility, the Java engine, as already mentioned, does offer the possibility of running JVM bytecode made by different languages, not just Java -- if you're in a multi-language shop that's a pretty large positive. Vice versa, if you loathe Javascript but must execute some code in the user's browser, Java's GWT (generating the Javascript for you from your Java-level coding) is far richer and more advanced than Python-side alternatives (in practice, if you choose Python, you'll be writing some JS yourself for this purpose, while if you choose Java GWT is a usable alternative if you loathe writing JS).
In terms of libraries it's pretty much a wash -- the JVM is restricted enough (no threads, no custom class loaders, no JNI, no relational DB) to hamper the simple reuse of existing Java libraries as much, or more, than existing Python libraries are similarly hampered by the similar restrictions on the Python runtime.
In terms of performance, I think it's a wash, though you should benchmark on tasks of your own -- don't rely on the performance of highly optimized JIT-based JVM implementations discounting their large startup times and memory footprints, because the app engine environment is very different (startup costs will be paid often, as instances of your app are started, stopped, moved to different hosts, etc, all trasparently to you -- such events are typically much cheaper with Python runtime environments than with JVMs).
The XPath/XSLT situation (to be euphemistic...) is not exactly perfect on either side, sigh, though I think it may be a tad less bad in the JVM (where, apparently, substantial subsets of Saxon can be made to run, with some care). I think it's worth opening issues on the Appengine Issues page with XPath and XSLT in their titles -- right now there are only issues asking for specific libraries, and that's myopic: I don't really care HOW a good XPath/XSLT is implemented, for Python and/or for Java, as long as I get to use it. (Specific libraries may ease migration of existing code, but that's less important than being able to perform such tasks as "rapidly apply XSLT transformation" in SOME way!-). I know I'd star such an issue if well phrased (especially in a language-independent way).
Last but not least: remember that you can have different version of your app (using the same datastore) some of which are implemented with the Python runtime, some with the Java runtime, and you can access versions that differ from the "default/active" one with explicit URLs. So you could have both Python and Java code (in different versions of your app) use and modify the same data store, granting you even more flexibility (though only one will have the "nice" URL such as foobar.appspot.com -- which is probably important only for access by interactive users on browsers, I imagine;-).
Watch this app for changes in Python and Java performance:
http://gaejava.appspot.com/
(edit: apologies, link is broken now. But following para still applied when I saw it running last)
Currently, Python and using the low-level API in Java are faster than JDO on Java, for this simple test. At least if the underlying engine changes, that app should reflect performance changes.
Based on experience with running these VMs on other platforms, I'd say that you'll probably get more raw performance out of Java than Python. Don't underestimate Python's selling points, however: The Python language is much more productive in terms of lines of code - the general agreement is that Python requires a third of the code of an equivalent Java program, while remaining as or more readable. This benefit is multiplied by the ability to run code immediately without an explicit compile step.
With regards to available libraries, you'll find that much of the extensive Python runtime library works out of the box (as does Java's). The popular Django Web framework (http://www.djangoproject.com/) is also supported on AppEngine.
With regards to 'power', it's difficult to know what you mean, but Python is used in many different domains, especially the Web: YouTube is written in Python, as is Sourceforge (as of last week).
June 2013: This video is a very good answer by a google engineer:
http://www.youtube.com/watch?v=tLriM2krw2E
TLDR; is:
Pick the language that you and your team is most productive with
If you want to build something for production: Java or Python (not Go)
If you have a big team and a complex code base: Java (because of static code analysis and refactoring)
Small teams that iterate quickly: Python (although Java is also okay)
An important question to consider in deciding between Python and Java is how you will use the datastore in each language (and most other angles to the original question have already been covered quite well in this topic).
For Java, the standard method is to use JDO or JPA. These are great for portability but are not very well suited to the datastore.
A low-level API is available but this is too low level for day-to-day use - it is more suitable for building 3rd party libraries.
For Python there is an API designed specifically to provide applications with easy but powerful access to the datastore. It is great except that it is not portable so it locks you into GAE.
Fortunately, there are solutions being developed for the weaknesses listed for both languages.
For Java, the low-level API is being used to develop persistence libraries that are much better suited to the datastore then JDO/JPA (IMO). Examples include the Siena project, and Objectify.
I've recently started using Objectify and am finding it to be very easy to use and well suited to the datastore, and its growing popularity has translated into good support. For example, Objectify is officially supported by Google's new Cloud Endpoints service. On the other hand, Objectify only works with the datastore, while Siena is 'inspired' by the datastore but is designed to work with a variety of both SQL databases and NoSQL datastores.
For Python, there are efforts being made to allow the use of the Python GAE datastore API off of the GAE. One example is the SQLite backend that Google released for use with the SDK, but I doubt they intend this to grow into something production ready. The TyphoonAE project probably has more potential, but I don't think it is production ready yet either (correct me if I am wrong).
If anyone has experience with any of these alternatives or knows of others, please add them in a comment. Personally, I really like the GAE datastore - I find it to be a considerable improvement over the AWS SimpleDB - so I wish for the success of these efforts to alleviate some of the issues in using it.
I'm strongly recommending Java for GAE and here's why:
Performance: Java is potentially faster then Python.
Python development is under pressure of a lack of third-party libraries. For example, there is no XSLT for Python/GAE at all. Almost all Python libraries are C bindings (and those are unsupported by GAE).
Memcache API: Java SDK have more interesting abilities than Python SDK.
Datastore API: JDO is very slow, but native Java datastore API is very fast and easy.
I'm using Java/GAE in development right now.
As you've identified, using a JVM doesn't restrict you to using the Java language. A list of JVM languages and links can be found here. However, the Google App Engine does restrict the set of classes you can use from the normal Java SE set, and you will want to investigate if any of these implementations can be used on the app engine.
EDIT: I see you've found such a list
I can't comment on the performance of Python. However, the JVM is a very powerful platform performance-wise, given its ability to dynamically compile and optimise code during the run time.
Ultimately performance will depend on what your application does, and how you code it. In the absence of further info, I think it's not possible to give any more pointers in this area.
I've been amazed at how clean, straightforward, and problem free the Python/Django SDK is. However I started running into situations where I needed to start doing more JavaScript and thought I might want to take advantage of the GWT and other Java utilities. I've gotten just half way through the GAE Java tutorial, and have had one problem after another: Eclipse configuration issues, JRE versionitis, the mind-numbing complexity of Java, and a confusing and possibly broken tutorial. Checking out this site and others linked from here clinched it for me. I'm going back to Python, and I'll look into Pyjamas to help with my JavaScript challenges.
I'm a little late to the conversation, but here are my two cents. I really had a hard time choosing between Python and Java, since I am well versed in both languages. As we all know, there are advantages and disadvantages for both, and you have to take in account your requirements and the frameworks that work best for your project.
As I usually do in this type of dilemmas, I look for numbers to support my decision. I decided to go with Python for many reasons, but in my case, there was one plot that was the tipping point. If you search "Google App Engine" in GitHub as of September 2014, you will find the following figure:
There could be many biases in these numbers, but overall, there are three times more GAE Python repositories than GAE Java repositories. Not only that, but if you list the projects by the "number of stars" you will see that a majority of the Python projects appear at the top (you have to take in account that Python has been around longer). To me, this makes a strong case for Python because I take in account community adoption & support, documentation, and availability of open-source projects.
It's a good question, and I think many of the responses have given good view points of pros and cons on both sides of the fence. I've tried both Python and JVM-based AppEngine (in my case I was using Gaelyk which is a Groovy application framework built for AppEngine). When it comes to performance on the platform, one thing I hadn't considered until it was staring me in the face is the implication of "Loading Requests" that occur on the Java side of the fence. When using Groovy these loading requests are a killer.
I put a post together on the topic (http://distractable.net/coding/google-appengine-java-vs-python-performance-comparison/) and I'm hoping to find a way of working around the problem, but if not I think I'll be going back to a Python + Django combination until cold starting java requests has less of an impact.
Based on how much I hear Java people complain about AppEngine compared to Python users, I would say Python is much less stressful to use.
There's also project Unladen Swallow, which is apparently Google-funded if not Google-owned. They're trying to implement a LLVM-based backend for Python 2.6.1 bytecode, so they can use a JIT and various nice native code/GC/multi-core optimisations. (Nice quote: "We aspire to do no original work, instead using as much of the last 30 years of research as possible.") They're looking for a 5x speed-up to CPython.
Of course this doesn't answer your immediate question, but points towards a "closing of the gap" (if any) in the future (hopefully).
The beauty of python nowdays is how well it communicates with other languages. For instance you can have both python and java on the same table with Jython. Of course jython even though it fully supports java libraries it does not support fully python libraries. But its an ideal solution if you want to mess with Java Libraries. It even allows you to mix it with Java code with no extra coding.
But even python itself has made some steps forwared. See ctypes for example, near C speed , direct accees to C libraries all of this without leaving the comfort of python coding. Cython goes one step further , allowing to mix c code with python code with ease, or even if you dont want to mess with c or c++ , you can still code in python but use statically type variables making your python programms as fast as C apps. Cython is both used and supported by google by the way.
Yesterday I even found tools for python to inline C or even Assembly (see CorePy) , you cant get any more powerful than that.
Python is surely a very mature language, not only standing on itself , but able to coooperate with any other language with easy. I think that is what makes python an ideal solution even in a very advanced and demanding scenarios.
With python you can have acess to C/C++ ,Java , .NET and many other libraries with almost zero additional coding giving you also a language that minimises, simplifies and beautifies coding. Its a very tempting language.
Gone with Python even though GWT seems a perfect match for the kind of an app I'm developing. JPA is pretty messed up on GAE (e.g. no #Embeddable and other obscure non-documented limitations). Having spent a week, I can tell that Java just doesn't feel right on GAE at the moment.
One think to take into account are the frameworks you intend yo use. Not all frameworks on Java side are well suited for applications running on App Engine, which is somewhat different than traditional Java app servers.
One thing to consider is the application startup time. With traditional Java web apps you don't really need to think about this. The application starts and then it just runs. Doesn't really matter if the startup takes 5 seconds or couple of minutes. With App Engine you might end up in a situation where the application is only started when a request comes in. This means the user is waiting while your application boots up. New GAE features like reserved instances help here, but check first.
Another thing are the different limitations GAE psoes on Java. Not all frameworks are happy with the limitations on what classes you can use or the fact that threads are not allowed or that you can't access local filesystem. These issues are probably easy to find out by just googling about GAE compatibility.
I've also seen some people complaining about issues with session size on modern UI frameworks (Wicket, namely). In general these frameworks tend to do certain trade-offs in order to make development fun, fast and easy. Sometimes this may lead to conflicts with the App Engine limitations.
I initially started developing working on GAE with Java, but then switched to Python because of these reasons. My personal feeling is that Python is a better choice for App Engine development. I think Java is more "at home" for example on Amazon's Elastic Beanstalk.
BUT with App Engine things are changing very rapidly. GAE is changing itself and as it becomes more popular, the frameworks are also changing to work around its limitations.

Categories