Choosing Java vs Python on Google App Engine - Stack Overflow most recent 30 from stackoverflow.com 2019-10-24T03:11:56Z /feeds/question/1085898 https://creativecommons.org/licenses/by-sa/4.0/rdf /q/1085898 161 Choosing Java vs Python on Google App Engine Viet /users/128028 2009-07-06T08:05:58Z 2019-10-01T15:36:54Z <p>Currently Google App Engine supports both Python &amp; 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!</p> <p><strong>Edit:</strong> <a href="http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine?pli=1" rel="noreferrer">http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine?pli=1</a></p> <p><strong>Edit:</strong> By "power" I mean better expandability and inclusion of available libraries outside the framework. Python allows only pure Python libraries, though.</p> /questions/1085898/-/1085929#1085929 6 Answer by Brian Agnew for Choosing Java vs Python on Google App Engine Brian Agnew /users/12960 2009-07-06T08:13:08Z 2009-07-06T10:26:14Z <p>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 <a href="http://en.wikipedia.org/wiki/List_of_JVM_languages" rel="nofollow noreferrer">here</a>. <em>However</em>, 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.</p> <p>EDIT: I see you've found such a list</p> <p>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.</p> <p>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.</p> /questions/1085898/-/1086259#1086259 18 Answer by Judy2K for Choosing Java vs Python on Google App Engine Judy2K /users/133596 2009-07-06T09:48:32Z 2009-07-06T09:48:32Z <p>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.</p> <p>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 (<a href="http://www.djangoproject.com/" rel="noreferrer">http://www.djangoproject.com/</a>) is also supported on AppEngine.</p> <p>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).</p> /questions/1085898/-/1087878#1087878 123 Answer by Alex Martelli for Choosing Java vs Python on Google App Engine Alex Martelli /users/95810 2009-07-06T16:17:10Z 2009-07-06T16:17:10Z <p>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.</p> <p>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.</p> <p>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).</p> <p>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.</p> <p>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).</p> <p>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 <a href="http://code.google.com/p/googleappengine/issues/list" rel="noreferrer">Appengine Issues</a> 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).</p> <p>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 <em>and</em> 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;-).</p> /questions/1085898/-/1093160#1093160 7 Answer by Paul for Choosing Java vs Python on Google App Engine Paul /users/134329 2009-07-07T15:50:45Z 2011-11-09T17:34:34Z <p>I'm strongly recommending Java for GAE and here's why:</p> <ol> <li>Performance: Java is potentially faster then Python.</li> <li>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).</li> <li>Memcache API: Java SDK have more interesting abilities than Python SDK.</li> <li>Datastore API: JDO is very slow, but native Java datastore API is very fast and easy.</li> </ol> <p>I'm using Java/GAE in development right now.</p> /questions/1085898/-/1337632#1337632 2 Answer by synchromesh for Choosing Java vs Python on Google App Engine synchromesh /users/122085 2009-08-26T21:36:11Z 2009-08-26T21:36:11Z <p>There's also project <a href="http://code.google.com/p/unladen-swallow/wiki/ProjectPlan" rel="nofollow noreferrer">Unladen Swallow</a>, 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.</p> <p>Of course this doesn't answer your immediate question, but points towards a "closing of the gap" (if any) in the future (hopefully).</p> /questions/1085898/-/1442628#1442628 1 Answer by yanchenko for Choosing Java vs Python on Google App Engine yanchenko /users/15187 2009-09-18T04:40:43Z 2009-09-18T04:40:43Z <p>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.</p> /questions/1085898/-/1464516#1464516 71 Answer by Richard Watson for Choosing Java vs Python on Google App Engine Richard Watson /users/78212 2009-09-23T07:45:21Z 2017-08-09T17:05:52Z <p>Watch this app for changes in Python and Java performance:</p> <p><a href="http://gaejava.appspot.com/" rel="nofollow noreferrer">http://gaejava.appspot.com/</a> (edit: apologies, link is broken now. But following para still applied when I saw it running last)</p> <p>Currently, Python and using the low-level API in Java are faster than JDO on Java, <strong>for this simple test</strong>. At least if the underlying engine changes, that app should reflect performance changes.</p> /questions/1085898/-/2636174#2636174 2 Answer by kilon for Choosing Java vs Python on Google App Engine kilon /users/316346 2010-04-14T09:14:37Z 2010-04-14T09:14:37Z <p>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. </p> <p>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. </p> <p>Yesterday I even found tools for python to inline C or even Assembly (see CorePy) , you cant get any more powerful than that. </p> <p>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.</p> <p>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. </p> /questions/1085898/-/2638859#2638859 9 Answer by Tom for Choosing Java vs Python on Google App Engine Tom /users/150016 2010-04-14T15:44:29Z 2013-04-19T17:01:11Z <p>An important question to consider in deciding between Python and Java is <strong>how you will use the datastore in each language</strong> (and most other angles to the original question have already been covered quite well in this topic).</p> <p><strong>For Java</strong>, the standard method is to use JDO or JPA. These are great for portability but are not very well suited to the datastore.</p> <p>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.</p> <p><strong>For Python</strong> 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.</p> <p>Fortunately, there are solutions being developed for the weaknesses listed for both languages.</p> <p><strong>For Java</strong>, 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 <a href="https://github.com/siena/siena" rel="nofollow noreferrer">Siena project</a>, and <a href="https://code.google.com/p/objectify-appengine/" rel="nofollow noreferrer">Objectify</a>. </p> <p>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.</p> <p><strong>For Python</strong>, 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 <a href="http://code.google.com/p/typhoonae/" rel="nofollow noreferrer">TyphoonAE</a> project probably has more potential, but I don't think it is production ready yet either (correct me if I am wrong).</p> <p>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.</p> /questions/1085898/-/2680204#2680204 3 Answer by Damon Oehlman for Choosing Java vs Python on Google App Engine Damon Oehlman /users/178820 2010-04-21T03:54:05Z 2010-04-21T03:54:05Z <p>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 <a href="http://gaelyk.appspot.com/" rel="nofollow noreferrer">Gaelyk</a> 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.</p> <p>I put a post together on the topic (<a href="http://distractable.net/coding/google-appengine-java-vs-python-performance-comparison/" rel="nofollow noreferrer">http://distractable.net/coding/google-appengine-java-vs-python-performance-comparison/</a>) 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.</p> /questions/1085898/-/2979149#2979149 3 Answer by Noah McIlraith for Choosing Java vs Python on Google App Engine Noah McIlraith /users/255344 2010-06-05T04:24:36Z 2010-06-05T04:24:36Z <p>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.</p> /questions/1085898/-/3393601#3393601 6 Answer by mjhm for Choosing Java vs Python on Google App Engine mjhm /users/400286 2010-08-03T04:37:36Z 2010-08-03T04:37:36Z <p>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.</p> /questions/1085898/-/5096947#5096947 1 Answer by Juha Palomäki for Choosing Java vs Python on Google App Engine Juha Palomäki /users/350615 2011-02-23T20:51:34Z 2011-02-23T21:00:23Z <p>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. </p> <p>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.</p> <p>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.</p> <p>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. </p> <p>I initially started developing working on GAE with Java, but then switched to Python because of these reasons. My <em>personal feeling</em> 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.</p> <p><strong>BUT</strong> 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. </p> /questions/1085898/-/18255495#18255495 15 Answer by Bijan for Choosing Java vs Python on Google App Engine Bijan /users/306478 2013-08-15T15:00:01Z 2013-08-15T15:00:01Z <p><strong>June 2013:</strong> This video is a very good answer by a google engineer:</p> <p><a href="http://www.youtube.com/watch?v=tLriM2krw2E" rel="noreferrer">http://www.youtube.com/watch?v=tLriM2krw2E</a></p> <p>TLDR; is: </p> <ul> <li>Pick the language that you and your team is most productive with</li> <li>If you want to build something for production: Java or Python (not Go)</li> <li>If you have a big team and a complex code base: Java (because of static code analysis and refactoring)</li> <li>Small teams that iterate quickly: Python (although Java is also okay)</li> </ul> /questions/1085898/-/25894549#25894549 5 Answer by Jaime Ivan Cervantes for Choosing Java vs Python on Google App Engine Jaime Ivan Cervantes /users/1404614 2014-09-17T15:24:57Z 2014-09-19T17:40:53Z <p>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. </p> <p>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 <strong>September 2014</strong>, you will find the following figure:</p> <p><img src="https://i.stack.imgur.com/z4M8C.png" alt="GAE Language Stats"></p> <p>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 &amp; support, documentation, and availability of open-source projects.</p>