My AppEngine Application is too slow, how to speedup the application? - java

I am developing an AppEngine application with GWT framework using Java. Objectify as back-end(storage purpose). Application has around 30 modules. Whenever I open any page in my web application, it is too slow to display. I want my application faster.
Please help me out with this nasty problem.

Two back to back steps.
Here is the SpeedTracer
And here is the Optimization Techniques of GWT

as already mentioned above, do this steps in general.
but developing for AppEngine needs thinking for AppEngine.
so also AppEngine Docu:
https://developers.google.com/appengine/kb/java#What_Is_A_Loading_Request
Main stuff: AppEngine is not a Java App Server like, Tomcat, Jboss and so on.
AppEngine is a complete own environment running java, (this you should at latest realize when you downloaded the AppEngine SDK )
and then you should see two options, change your account to billing account, and pay for preloaded App
or better, forgot about third party libs and write it by yourself,
for what you need objectify ??? the appengine datastore api is very good.
using the Apis directly will also point your thinking of how to design your app for AppEngine better.

Use Appstats to profile your application and identity which RPCs are slowing down your app.
Having done this, you should be able to find ways to reduce the number of RPCs you're making, e.g. by using memcache. You could also try to use async APIs wherever possible.

You should think to cache data for the session or across sessions on your client side also. You can do statistics on the most common requests and do server caching on them too

I am quite certain the reason its slow is because your application loads all the code in the browser.
Use HTTP watch tool to see whether this is correct. For a 2MB nocache.js file it usually takes 2 minutes to load.
Are you using any MVP framework on your application; if not, this could be one of the problem. Objectify is not going to slow you application, I presume it is the way you built your application.
Also try to use GWT 2.5, so you can take advantage of the closure compiler so you can reduce you application's footprint for about 20% (maybe). Furthermore if you are deploying in Tomcat, you can try to enable gzip compression.
"Slowness" of an application can't be attributed to just one part of the application, it could be spread across the layers of your application (based on my experience)
Hope this helps.

Related

DropWizard without HTTP?

We've developed a significant project in DropWizard, but the nature of the project has shifted, and we're moving away from having actual HTTP endpoints and toward RabbitMQ. However, DropWizard has a lot of cool features we'd like to keep using, and besides the pain of replication, it would take a lot of worker hours to stop organizing things as (e.g.) DropWizard services.
With all that said: is it possible to run a DropWizard application without any open ports?
Yes you very well can, see here & here.
DropWizard has a lot of cool features we'd like to keep
using
Which feature are you interested in?
Since Dropwizard is primarily built to serve HTTP traffic, it has Jetty & Jersey which will be initialised on your app startup, it doesn't make sense for your app to have these if you never plan to build an some sort of an API inside your app (say for custom-monitoring, health-checks etc.,).

Is stripes a small footprint framework to make a small web application in a coporate enviroment?

I am looking to make a small web application for my group. The issue is the IT team makes having a server etc... impossible. The application would be a custom searchable database web-app. I am restricted to just having a folder on a network drive. I cannot have any installation on the users' machines. I was reading that web-apps might work. I could have all the information on the network drive everyone has access to and users can just type the address in their browser and fire up the web-app. I came across stripes and I am wondering if it fits the bill. There cannot be any footprint other than files in a folder. And many users need to access the files also. I also want it not to require much beyond a Windows OS. Will this work? The application is not really complicated. IT is not helping me but would be a great time saver for the group.
Thanks in advance.
Stripes is a really good, lightweight Java web application framework.
However, it won't work without a sever. So, to answer your question, the simple answer is: no.
Your requirements are absolutely not a recommended scenario, especially in a corporate environment. I'd always opt for a simple DB-based solution.
You could, however, and if your corporate data security guidelines permit it, use a (free) Google App Engine account, to run your Stripes application. Of course, any other free or cheap platform will do.
If you can only have a folder with files in it then no, you can't use Stripes. In fact, you can't use any web framework because web frameworks dynamically react to input. Just having a folder with files in it won't let you dynamically react to input. You need a server running that can interpret requests.

When to use GWT and when to not

I am wondering if there are specific cases where GWT is not suitable? For example would it be approriate to re-develop Stack Overflow using GWT?
I am developing an app which has a Java Restlet API and I was planning on using GWT (previously I would just have used bog-standard HTML/CSS with back-end PHP code calling an API). I am wondering if there are reasons why I shouldnt choose to do this?
My answer is not full but I believe the following bullets may be useful.
GWT should not be used for applications that mostly present textual information and some pictures, i.e. not very interactive. For these applications GWT does not bring you a lot of benefits.
GWT should not be used by teams that have strong web skill and relatively weak java skills.
Do not use GWT if you are required to support browsers that GWT does not support officially. For example MSIE 6.
have a look at this topic GWT for big projects?
GWT is best choice to manipulate complex actions in a single page. like Google wave, Google mail ... you can easily update (ajax) any part of the page.
Because of the GWT is java-to-javascript compiler, user should wait the loading of .js files and it causes many and many problems if your web app is big. The bigger your project, the bigger javascript files, the more user should wait the loading of .js files
IMHO If you have a static looking website like a blog, news portals, etc which each page has its own identity and represents an entity and is requested separately don't use GWT alone (you can still mix it with server-side generated pages like FB).
For most of other web apps especially if users sign in to use your app or your app is interactive and there is no technical problem use GWT (like Gmail design).
I would propose to avoid GWT at any cost. I have experience developing huge project with GWT and it is nightmare, because of long development circle. If you have application in angularjs/react/jquery, you update source code, click F5 and reload it. You can quickly debug clicking F12.
If you use GWT on huge project, you have to wait ~1 min for app to compile. And then there is no good way to debug it. Google provided special browser plugins, but they worked unstable and didn't support last versions of browsers, so I had to downgrade FF. Also huge GWT app debuggin takes tons of java memory, so you have to provide more memory to tomcat. And finally in practice you can't avoid learning js, you will have to learn it if you do modern web development.
UPDATE 15.05.2017: My answer was downvoted by GWT fans, but I'd like to note, that my info is up to date: 1-page hello world app rebuild cyrcle takes about 30seconds with last IDEA and 10Gb mem SSD notebook. I also asked friends having GWT in production for serious project: they claim 2min is average redeploy time.

Which is better for Java development hosting: Aptana? Google App Engine? Slice Host?

I am split between the benefits of developing Java (non-commercial) webapps and deploying to something like Aptana or Google cloud, or just going with a Slice Host account. Tomcat or Jetty and MySQL are really my only big requirements. Aptana and Google App Engine come with some cool Eclipse deployment options, but does scalability really matter without a large user base for the apps?
Also, both Aptana and Google App Engine seem to be in infant stages, so I'm wondering if there will be too many restrictions, even for small time development. Anyone have experience with these?
I can't speak to Aptana but Google App Engine is a radically different development experience from what you'll get with something like Slicehost. It scales differently (i.e. you've got the possibility of handling much larger loads) but it's also totally different than running your own web app server (e.g. Glassfish, Tomcat, JBoss, etc.) and coding using "standard" Java tools.
With Slicehost or any hosted solution it's easy to setup your own development environment locally which exactly mimics what you'll be running on the server. Same software, same VM, maybe even the same version of Linux. You could even move to a different host and still be able to setup that same environment.
With Google App Engine you'll find yourself building on an emulator (you don't really run BigTable locally) so there's not a one to one correspondence between your environment and that on the server. There's no alternative place to move to and still be running in the same environment either. Also, some perhaps many of the popular Java frameworks you might use for a web app development will either not work at all (e.g. ) or will not work out-of-the-box (see here for more details).
I'm not down on the App Engine, in fact, I think it's really cool. If the demand for your apps is relatively low and therefore you're not in need of the huge scaling requirements, but your traffic is not so low that you fit comfortably within the free allowance at Google then I would probably lean towards a hosted solution like Slicehost instead.
I use slicehost and I am happy with the result so far. Its easy to upgrade your slice (I had to do it once already) and its easy to rollback to a backup of the slice (I had to do that once too). I am hosting Tomcat and MySQL.
Bear in mind, Google App Engine does not give you a full JRE. You cannot spawn threads directly, for example. Also, I have found that the GAE datastore performance is too slow -- I run into timeout exceptions constantly. In sum, it is not a true application hosting solution. You have to heavily tailor your application to make it run on GAE.
I'd suggest using Amazon Web Services. You get the power of the cloud with no limitations to your app, unlike App Engine.

How to take a Java Web-application offline?

We develop Java Web-aps (Websphere, DB2) which display graphical and databased information. We would also like to offer the same application offline (distribution via CD/DVD) with online data-update. We have tried a number of alternatives in the past, but nothing has been really stable. What are the new best practices to take a Web ap plus data (in a small database) offline?
I don't know how well it works with the CD/DVD distribution front, but the first thing that comes to mind is Gears. On the .NET side of the fence there's Silverlight 2. Then there's the Mozilla Prism project, although I don't know how far advanced that is.
These are all designed for not just offline access, but mixed offline/online, talking to a server when it's available and working locally when necessary.
I'd suggest using Apache Derby as the database (also available as Sun's Java DB, and possibly still IBM Cloudscape (does that still have DB2 compatibility in place?)).
I'm sure there's plenty of Web servers/Servlet containers about. Apache Tomcat is the obvious one. An alternative approach would be to use an embedded native browser within a single Java process. That approach should be relatively hassle free for users and tech support, and you can just use WebStart to install and update.
If you're using EJBs and other nonsense, then there are similar freebies about. I understand Sun Glassfish is nice and fast starting.
You could create an image of your server as a VMware instance and distribute it with a copy of VMware player (licensing allowing of course). Personally I'd build it on top of a Linux distribution like CentOS5.
You can bundle a JRE along with JETTY server and use a different database e.g HSQLDB (that you can bundle inside the webapp itself).
If you are using an ORM tool to connect to database, you might not have to make many code changes for this.
A lot of Application server distribute their admin consoles like this.For e.g Weblogic admin console runs offline (it uses internal ldap server for its database)
Also as far as Google gears is concerned, they are also pretty much doing the same thing.
They have a server that is bundled along with SQLDB and they allow to synchronize the data between online offline app.
You can sync the data too (use webservices in the online app) and talk over https from the offline app to sync the data, if you need the sync feature.
Also you can check this link
http://developers.sun.com/learning/javaoneonline/2007/pdf/TS-69700.pdf

Categories