We are building a web portal based application with html5/javascript frontend and Play framework backend with mongodb.
I am an algorithm developer from the networking industry, we have to do design analysis of networks. This is done by complex algorithms in standalone java based application today. We are planning to move this standalone logic to the play application server with user logic and session management.
This would mean, we would have huge object cache and processing requirement everytime a user asks for analysis and we are planning for a 100+ user simultaneously. There is also lot of static data present today in the java cache model of the standalone application.
I am new to application server space, many people suggested that web application servers are not meant to manage this kind of usecase and the object cache is meant for volume query on a db and simpler rendering of db data, rather than running algorithms on it.
Question I have are :
Can Play or any other web application server manage such processing need?
Is there any design recommendation to convert heavy java based stand-alone tools to web-based, business logic and session managed and db persisted environment?
Related
I am making an inventory management program which has a Swing GUI as front end, with multiple users on LAN sharing a database.
I have successfully made my GUI components and a local DB and run the program as per my requirements on a standalone pc(without networking).
Now, I need some insight as to how to scale my application to a network environment. I have already tried the following and it fails:
Having MSACCESS on one of the computers, I make a connection to the db with DriverManager.getConnection("jdbc:ucanaccess:////COMPUTER-PC/admin/DB.accdb");
All works well, however when 2 users are simultaneously connecting to the database, after certain update queries from both users, the data does not remain consistent. I am stuck here. How to manage the data and maintain consistency.
You're describing a 2-tier architecture (client-db).
In most cases you want to have the business logic, consistency check etc. on the backend and thus a 3-tier architecture (client-backend-db).
You can e.g. use Spring Boot to create a simple backend.
Spring Initializr can get you started e.g. with Spring Web (MVC), Spring Data JPA and H2 Database (if you don't need to use MS Access) module selected.
The downsides are:
you need a server to run the Spring Boot JAR. But you can also run it on the machine currently running MS Access.
you need to think about client-backend communication, e.g. using REST. But there are many samples on the Internet, e.g. using Spring RestTemplate or Spring WebClient.
Your question seems little basic to me .
This book by Martin Fowler is little old but It will give you a solid foundation .
Patterns of Enterprise Application Architecture Hardcover
by Martin Fowler
After one year i have finished the development of my application.
Now when searching the internet i got a new knowledge about the 3tiers applications.
My Application running on 2tier Architecture (Standalone application connecting directly to database server).
My Application Developed using:
- Java SE (Swing).
- MySQL Server as database server.
I want to reconstruct my application to be 3tier application. (Client-Server)
- What technology i have to use?
- What I have to change within my current code?
- The application will run on network, there will be Many concurrent users who will use the application accessing the database (Insert,Update,Delete ... etc).
There are two main approaches. The first involves rewriting the client in HTML/JavaScript with help from one of the many available frameworks (Struts, Spring, Java Server Faces, etc.) Unless you specifically prefer a web application to a Swing application, or your user interface is a very thin layer on top of your business logic, then this is a costly approach.
The second approach involves inserting a server between your user interface and your database. Open source Java-based servers include Jetty, Tomcat, Spring, JBoss/WildFly and GlassFish.
If your code is structured in layers so that the user interface, the business logic and the data access code belong to separate layers, then converting from a two-tier system to a three-tier system should be straightforward once you understand the capabilities of your chosen mid-tier server and how to use them.
The basic technique is:
All user interface/Swing code remains on the client.
All business logic moves to the middle-tier server. The client talks to the business logic using a remote protocol.
All data access code is moved to the server.
Dependency Injection is useful to perform this refactoring step-by-step and also allow you to choose between working in two-tier or three-tier mode if that is needed.
The three main differences between a two-tier and three-tier application are:
Security - there is a new access point into your system. You need to be careful about the access rights it has to the database - do you have one server user that can do everything, or does each user need to use their own connection credentials. You also need to secure the server correctly and be careful not to add security holes in your mid-tier API.
Remote access - some method calls that were previously made within the same process are now made across the network. Server APIs generally need to support less fine-grained operations than local APIs, and the amount of data shipped as arguments and return values may also need to be managed.
The structure of your application becomes more important. The code isn't necessarily very different, but it will need to be organised into different layers.
Java EE is your answer.You could choose a framework like Hibernate/Spring/Struts to build a 3 tier architecture (MVC).You would also need to make a choice for a servlet container.Apache Tomcat should be a good choice.
It would be nice if you could post little more details like complexity , purpose etc. of your application.
I am creating a java based application and i want to use google app engine for its deployment. But i want this application to be movable to other servers like tomcat etc on my local or other machines. So i though want to use google app engine. But want to keep my application independent of any Google specific things. Can somebody summarize the points i must take care of. I want to keep it independent both from application and database layer perspective.
Though I am not master in google app engine however the thumb rule to make your webapp portable is to use standard specification APIs instead of vendor specific APIs. For example if your app is using google app engine UserServive (com.google.appengine.api.users.UserService) or data store com.google.appengine.api.datastore.DatastoreService , if is tightly bound with Google app engine and can not be migrated to standalone tomcat engine.
To loose couple your database for further migration you should consider using MySQl schema in google app engine. Because in future you can host your database anywhere by just taking a dump. Also, you should use JDBC apis/JPA for database operations from your application using MySQL JDBC JAR
To summarize, you should avoid any API call which has com.google.appengine* import in your source. Also, you should have your own mysql schema running in google app engine cloud.
I think you can and it's only a matter of design.
Just an example: if your application need user authentication, you can create an interface AuthenticationService and two implementations:
GAEAuthenticationService for the Google App Engine
FakeAuthenticationService for local tests running with jetty (for example)
DataSourceAuthenticationService for authentication based on a DataSource
You can do the same think with persistence, scheduler, etc... the only thing to do is:
define the objects you need and use interfaces when you need different implementations that depends on platforms
I am about to develop my masters project using Flex as front end, BlazeDs, Java Web Services and MongoDB in the backend. I am looking to deploy and manage it on a cloud. (The application analyzes financial data from various sources, I will need to query multiple endpoints for news articles and DB for processing)
It is my experiment to usage of cloud rather than deploying on my local for demo and presentation purposes.
I saw heroku (http://www.heroku.com/), but I am not sure if it allows flash.
Please suggest a cloud application platform which allows Flex, BlazeDs, Java Web Services and MongoDB?
Amazon Web Services is a good place to start. You can have a instance ready in like 15-30min from signing up. If you are just experimenting, you ought to try to get the Amazon Linux Image (AMI) up and running. Scour the net on HOWTO set up Tomcat, for your requirements it might be too much to go J2EE, but you might know better.
But a word of advice, it's better to get your application working on a local machine first. Then drop the programmer hat and put on the deployment hat 100% cause it's a b!tch configuring deployment environment for Tomcat configurations, Blaze DS, Mongo's failover servers, load balancers and all kinds of non-programming tasks. You will want to work your development stack close to home so you can diagnose quickly.
Cloud business is great only when you want 1) Not use your home PC and bandwidth as a server 2) You want to have global mirror points to your application so that user's latency in one area of the world is not slower than another part of the world 3) You want to distribute computing load burden on one application across many instances of the same application.
Clouds are relatively cheap to deploy but if you got an application that hording GB's of bandwidth and storage, be prepared to fork over $1000's+ in costs. You can save money by going with an OS with no licensing costs to get a better rate.
I have a project this year. It is about developing a Java application with a database for sharing and validating documents between the manager, secretary and head of finance.
My question is: How to make the database accessible by all, since the application will be installed on computers that I mentioned above, do I have to install it (the database) on these computers? The constraints of consistency and integrity of the database will be violated. The users will not have the same copy after each update!
Is there a possibility (or technology in Java) to put the database on the web and there will be accessible by all, or make it accessible from a computer that I realize as a server (client-server).
I would be grateful for your help or giving links for Tutorials.
How to make the database accessible by all, since the application will be installed on computers that I mentioned above, do I have to install it (the database) on these computers? The constraints of consistency and integrity of the database will be violated. The users will not have the same copy after each update!
Your question suggests that you will need one database on one computer. Let's call it a DB computer. I'd suggest this be a server, that no one from regular staff, such as secretary, manager, etc... can access.
Having one central database will eliminate your worries about integrity violation.
Now, you have two options. You can make a web application that your users will use to interact with your system. This is a more modern approach, since you'll have a 3 tier system:
users will access your application via a browser
the web application itself is stored on an application server, and it is accessing the database
the database is the backend part
The second option is making a desktop application and deploying it to everybody's computer that will use it; and afterwards making it connect to the database for interacting with it.
The first option is easier when you want to expose your application to a large number of users (and to the web), but know what you're doing when doing stuff like this, since you have to take security very seriously.
If you go the first route, you will need a few things:
First, a database. Use what you can, but if you need free and high quality databases, use PostgreSQL or MySQL.
Second, an application server. I suggest using Tomcat or GlassFish.
Now, you need to develop your application using JavaEE. There is a wealth of information about this, so I hope this will help you in the beginning and point you in the right direction.
Note that Tomcat doesn't support Java EE fully, but a subset of it. And this subset is surely more than enough for what you need to accomplish.
If I understand you correctly, you are looking for ways to implement a client-server system, where several clients on distinct computers each connect to a central server (or cluster of servers) hosting a DB. In Java, usually (but not necessarily) the DB is inside a web application, and the clients are lightweight web clients - in this case it is usually called an enterprise application.
Java has a whole dedicated SDK for this, called Java Enterprise Edition. You may find many questions dealing with this on SO, here are a few which I think may be especially helpful:
Is the offical Sun Java EE tutorial the best way to learn how to make Java web apps?
What to learn for making Java web applications in Java EE 6?