What is the best way to make a train route application with Spring Boot and Azure? - spring

My question here is my own follow up of a school project. We implemented a basic train system with 15 cities and when the user inputed 2 cities (aka current location and destination) the app returned the quickest way from A to B as well as the cheapest. We ran A Star algorithms for this.
My question here is: If i wanted to implement this with Spring Boot and Azure how would i do it? I assume MySQL for pathfinding could be bad in performance or even just impossible to simulate a graph. We used guava graph (extended versions) for the "vanilla" app, but how would i do it in a real world environment? How would i be able to run a star searches? I've heared about Cosmos Gremlin and there is a Spring Boot starter and all, but would this be possible? If so how, or even if its reasonably doable with MySQL, how?
Thanks in advance

Related

How to structure and deploy server for multiple instances of the front apps with same business logic?

I'm a mobile/front-end developer and need help with the architecture on the back-end where I'm totally green. I'm building web and mobile front in Flutter that will communicate with the server written in GO. Based on the config file attached the Flutter front I will create few separate apps, but for every single app I need a separate instance of the back-end services or at least separate database.
My question is about what architecture I should use in terms of future scaling to lower the server maintenance costs while having the best performance. Correct me if I'm wrong because what I will write is the image of my understanding of the structure but based on what I wrote above - am I correct that I should use some load balancer with the business logic spread across Kubernetes instances and only have separate database for every single Flutter app? Or is there any other solution I'm unaware about? Any help or guides that will at least lead me to more knowledge I can learn would be much appreciated.
I don't know yet whether it's a perfect solution but I will leave it if someone in future will be looking for it. My friend who codes in PHP introduced me to the multi tenant architecture pattern and after I've researched it I find it a good solution to what I've been looking for.

Is there enough to working with Spring Boot if I known to perform CRUD Operation?

I am a completely fresher for Spring Boot. I had learn to perform Basic CRUD operations using REST API. That basic knowledge is enough to working with Spring Boot Project. Can I able to work with that?
No one is technically perfect!
Every day we are exploring new things and implement new solutions as per the new business requirements. The developer should possess a good set of problem-solving skills. That’s because it’s common for developers to come across multiple programming problems while building just about any solution.
If your lead assigned a task to you explore quarkus and implement a simple CRUD operation using go language what you will do?
"I don't know golang", Is this your answer?
Qualities of a good junior software programmer
Learn new things daily which must be useful to the growth of the company, your team and you.
Problem Solving and Logical Thinking
Written and Verbal Communication
Teamwork
Interpersonal skills
Time management
How do I search for answers from StackOverflow like a PRO? This is a very important skill set, Really, I am not joking.
Health - Health(Physical/Mental) is an important asset, don't take official things personally. Manage stress etc...
Coming to technical side
It would be good if you know at least one programming language, in your case java is fine. But if you have the listed skill sets you can learn anything very easily.
Regarding Spring boot
Do you want to become an expert in the Spring framework? Work with one big project, whatever domain.
Refer - https://www.baeldung.com/
Once you become pro - Refer - https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/
As a starter this is fine, but if your application is going to face real customers/users and want to evolve your application over time, then you would need to consider concepts like below
Login/logout security with Spring Security (if stateless then JWT is a good choice)
Evolving code and database with versions of your software (can use Liquibase to evolve and maintain DB changes ).
Handling exceptions as Aspects from Spring.
Having coded business errors so your team can resolve them and classify them accordingly.

Spring HATEOAS: Practicable for a microservice architecture?

I know this question was already asked but I could not find a satisfying answer.
I started to dive deeper in building a real restful api and I like it's contraint of using links for decoupling. So I built my first service ( with java / spring ) and it works well ( although I struggled a bit with finding the right format but that's another question ). After this first step I thought about my real world use case. Micorservices. Highly decoupled individual services. So I made a my previous scenario and I came to some problems or doubts.
SCENARIO:
My setup consists of a reverse proxy ( Traefik which works as service discovery and api gateway) and 2 Microservices. In addition, there is an openid connect security layer. My services are a Player service and a Team service.
So after auth I have an access token with the userId and I am able to call player/userId to get the player information and teams?playerId=userId to get all the teams of the player.
In my opinion, I would in both responses link the opposite service. The player/userId would link to the teams?playerId=userId and vice versa.
QUESTION:
I haven't found a solution besides linking via a hardcoded url. But this comes with so many downfalls as I can't imagine that this a solution used in real world applications. I mean just imagine your api is a bit more advanced and you have to link to 10 resources. If something changes, you have refactor and redeploy them all.
Besides the synchonization problem, how do you handle state in such a case. I mean, REST is all about state transfer. So I won't offer the link of the player to teams service if the player is in no team. Of course I can add the team ids as attribute to the player to decide whether to include the link or not. But this again increases coupling between the services.
The more I dive in the more obstacles I find and I'm about to just stay with my spring rest docs and neglect the core of Rest which I is a pity to me.
Practicable for a microservice architecture?
Fielding, 2000
The REST interface is designed to be efficient for large-grain hypermedia data transfer, optimizing for the common case of the Web, but resulting in an interface that is not optimal for other forms of architectural interaction.
Fielding 2008
REST is intended for long-lived network-based applications that span multiple organizations.
It is not immediately clear to me that "microservices" are going to fall into the sweet spot of "the web". We're not, as a rule, tring to communicate with a microservice that is controlled by another company, we often don't get a lot of benefit out of caching, or code on demand, or the other rest architectural constraints. How important is it to us that we can use general purpose components to exchange information between different microservices within our solution? and so on.
If something changes, you have refactor and redeploy them all.
Yes; and if that's going to be a problem for us, then we need to invest more work up front to define a stable interface between the two. (The fact that we are using "links" isn't special in that regard - if these two things are going to talk to each other, then they are going to need to speak a common language; if that common language needs to evolve over time (likely) then you need to build those capabilities into it).
If you want change over time, then you have to plan for it.
If you want backwards/forwards compatibility, then you have to plan for it.
Your identifiers don't need to be static - there are lots of possible ways of deferring the definition of an identifier; the most obvious being that you can use another identifier to look up the identifier you want, or the formula for calculating it, or whetever.
Think about how Google works - the links they use change all the time, but it doesn't matter because the protocol (refresh your bookmarked search form, enter your text in "the" one field, click the button) hasn't changed in 20 years. The interface is stable (even though the underlying spellings of the identifiers is not) and that's enough.

Some concern about putting a payment/transactional app on GAE

I'm trying to build a shopping-cart-like webapp on GAE. So far, I haven't deployed anything on GAE still and just keep doing some POC locally... then, I read this:
http://borglin.net/gwt-project/?page_id=688
It surprised me when I read through those "weaknesses" and I'm pretty worried about whether it's a good choice putting the app on GAE. Would someone, esp who has experience building a real-world app with cash transactions, please give me some ideas/share your thoughts?
The article said GAE has "No https support for your domain". Is it true? I thought what I need to do is just point my domain https://www.abc.com to GAE https://abc.appspot.com ...
For BigTable, I understand it would be quite hard to build analytic/statistical functionalities in my app (e.g. provide a monthly transaction summary). Does anyone has any experience to handle such situation...? export data from BigTable to RDBMS and do some SQL ...?
The articale also said that BigTable has a bad write performance: "I'm lucky to get 100 writes per second in a GAE request. " Is it true? I cannot find any figure to support/disprove it ..
I'm now using SpringMVC + Objectify at server-side. Is it too heavy for GAE ? Some said Spring could make a long cold start ... how cold is it? How long would it take to init an app with like, 20+ different pages/controllers, and 20+ kinds of entities/DAO ..?? Any ballpark figure ..??
p.s. If you know any real world app built on GAE, please kindly share here? Because I wanna know how far (or how big) my app could be.
Thanks a lot!
1) That is true. https is only supported for .appspot.com. A very big shortcoming.
2) That's not really true, you can do any kind of monthly summary reports using the remoting api if you need to do complex joins and such. You can also export the data and use an offline tool
3) I haven't seen that kind of write performance bottleneck, but there is eventual consistency to deal with. That said, 100 writes/second is not a small number...
4) I would avoid spring on appengine. A lot of people use it happily but I found that startup time was very slow and that caused problems.
The SSL for Custom Domains is in testing phase. Please note that HTTPS/SSL was not designed to work on shared-IP hosting (such as GAE), so there are some SSL extensions that have various support on browsers (SNI/VIP).
Queries are quite weak on Datastore. They are also expensive. There are two ways to do analytics:
a. Create a set of sharded counters and update the counter every time an event happens (= a financial transaction). We use this and is works well. The only downside is that this is "online" analytics. You can not add additional analytics parameters for the past data.
b. Upload (anonymized) data to Google Big Query and do analytics there.
Datastore has a limitation of about 5 writes-updates/s to a SINGLE entity or entity group (some sources say 1 w/s). There is no limitation on parallel writes to different entities. Remember, GAE is a distributed system where all apps use ONE BigTable database under the hood. So this is pretty scalable.
I don't have experience with this, but there are various reports on the net. See this http://www.listry.com/blog/2010/03/google-app-engine-cold-start-guide-for
I dont know about other topics, but what I can tell you is that we use a combination of Guice + jersey to substitute Spring :) its better for GAE if we take into account rhe startup time

Architecture definition: MVC 3 (Sharp architecture) + Multi-Tenancy

I would like to share my thoughts with you and try to get some advice. I would like to
define my application with the best architecture as possible. Any comment would be highly appreciated. Here we go...
My technologies: Sharp Architecture 1.9 (MVC3, NHibernate, Castle Windsor, etc...) and SQLServer database
My busniess case: SaaS application. Many customers with many users each one, one database per customer and the same code (just one instance)
of our code
Problem: I need to allow multiple users to connect to different databases at the same time
with the same code (just one installation). As far as I know Sharp Architecture doesn't support this stuff by default
After some research I found a new concept for me: Multi-Tenancy. I guess that is the proper way to do it.
So question is:
Is my assumption correct? Is multi tenancy the best way to reach my goal?
On the other hand I found a couple of interesting links:
http://weblogs.asp.net/zowens/archive/tags/Multi-tenancy/default.aspx (MVC approach)
http://msdn.microsoft.com/en-us/library/aa479086.aspx
Someone could provide me aditional info?
Thanks for your time
Best regards
Multi-tenancy is your right way to opt for solving your requirement. With multi-tenancy [Single database per tenant and single codebase] we identify the tenant and then use his database to either authenticate his users or use his tenant id to identify his application database and these can be achieved only in a multi-tenant enabled codebase.
If you are interested in delving deep further, please leave your comments so that we can take forward this discussion and involve the community from the architectural perspective.

Resources