Describe the transition to the SaaS model

What is the organic growth process from a stand-alone solution to software as a service ? It's clear that

Scalability is not a “feature” referenced at the end of development. ^

therefore, I am interested in a high level of code and architectural changes.

  • Does it select an existing platform and redefine it?

  • Do you run with bare-bone cloud architecture and then migrate legacy features?

  • Are aggressive technologies embedded in the process (i.e. web forms> MVC)?

Update:

I was asked to clarify the current architecture of the project. Without going into details, think about the .NET webforms application, which connects to the business logic layer and integrates with several third-party providers. Whenever new instances of the platform are required (I don’t have enough terminology here, I mean when a new client requires adjustments to business logic, integration with other third-party suppliers, hot new branding, etc.), the existing code is forked, and New environment to configure. Any changes are actually very low-level, regardless of whether they occur directly in the aspx files, in the component code or in the db configuration.

This scenario seems to be quite suitable for implementing the “right” SaaS model, but I am having difficulty constructively contributing to the migration process. To rephrase the initial questions, which would be an effective strategy to follow:

  • Redefine the existing platform and make everything customizable, effectively suspending this simulated scalability and not attracting new customers until the architecture is reorganized. The disadvantage of this imho continues to rely on code and a structure not built for scalability (details below).

  • Start from scratch with what is considered (subjectively) the best architecture for a future solution, and then reconfigure obsolete features as needed. This allows almost any desired technology update, but does not have visibility until completion and, being an aggressive change, will be considered inherently a high risk on the part of management.

Personally, I am inclined to the second option due to the amount of old code and the lack of sufficient normalization of dB. At the same time, the existing solution is mature and functional (if it is not broken, do not fix it), and there are many other ways of scaling, except for the two approaches listed above.

If the above context allows you to use recommendations for specific scenarios, I will take it. However, I am open to more general refinements and donts and pointers suitable for a wider audience.

+8
architecture cloud saas
source share
5 answers

Very short answer

The key is architecture. The way is to divide and win. The approach is to relax.

Longer answer

Architecture

The most important component of the building is its architecture. The path of space has walls and floors, windows and ceilings, i.e. Elements of the design itself. The goal of architects is not wall design. He designs them as a secondary part of this work: designing the space that is formed by the walls. We do not build buildings to have walls, we build them to have space inside.

We first develop the functionality that we want from software. Then we move on to the details that allow us to do this, i.e. Create a product. The technologies that we use are not the main ones, these are walls, and we really want this space.

With a good understanding of what we want from the software we create, engineering becomes much simpler and almost automatic. Technical difficulties begin to emerge with well-understood definitions and, fortunately, obvious solutions.

Divide and conquer

One very important indicator of good architecture is that it clearly defines the components of the solution. When we can see these components of the big picture separately, we can divide the work into separate parts. Then we can create separate things for collaboration.

Relax

Perhaps this name sounds like I'm trying to bring some kind of humor to the text; but no, please don't get me wrong. If you have a good architecture, you can relax, so your web servers, database servers, engineers, clients, users and the rest of the world. If this is not the case, then you should return to work on your architecture.

BUT?

Hey, what did I talk about here? These were some paragraphs and three titles, and I did not use a single software term other than software. Such an abstract Peter for guys who have nothing to do all day, but lazy to walk and talk, talk and talk ... We are software people, and we don’t have time for this. Hey, I, Hassan, cut it short ..!

Ok, I'll try; but first of all, let it relax ... then we can take a look at some real examples.

Examples

Let's say we are developing a web publishing service for professionals as well as individuals. Each client will have their own website that will work in our system. These websites may be regular personal websites with very few visitors, or if our business is lucky, some of our other customers may be large publications such as the NY Times.

We need to solve two problems of scalability: scaling our business, our system, when we start more and more customers, launch more and more websites. This is a rather simple problem compared to the second one, which scales one website, as it has more and more visitors, more and more data, more and more applications to work on this data.

We can rewrite the question “how to scale” as “how to divide” to see the solution more clearly. If we can divide something into small pieces, we can scale it by adding more resources to make these parts, increasing horizontally.

We will have data and applications that will work on this data. Say we have one database server and one web server and try to make it scalable.

Thinking of the web servers that we will run for our service; if we do not store data on these machines, they will turn into common, equal components, small data clients that will connect this data with the rest of the world. Due to the fact that our web servers are light, dumb, empty, we can easily get many of them to handle an increasing number of requests.

Well, turning web servers into just stupid proxies is not a smart idea. We need to do something, applications to run. And since web servers are the easiest to multiply in our architecture, we want to do as much as possible on these web servers. We will continue this complex issue under the heading “Smarter Separation” below. Before that, let's see what architecture we currently have in the table and how it is scalable.

We use load balancers to make many web servers work in parallel, as well as divide many websites into groups using DNS (even before the requests get into our system) to several load balancers. For example, a.com, b.com, c.com to load balancer 1, a-very-big-website.com to load balancer 2, ... Each group of load balancers, a set of web servers and a database server makes a separate universe in our system. Now we can have millions of websites and grow our system by adding more of these individual universes without any restrictions. We can serve as many customers with as many websites as our marketing department can offer. Our first problem has already been resolved. How about launching large large large sites?

Separation smarter

Of course, we cannot split a single website into separate universes, as with separate websites; but this does not mean that we cannot separate at all. We will continue to divide and conquer. To do this, we need to consider in more detail the problems that we solve.

What is a website? Web pages that support files such as css and js , multimedia content such as images and video files, and data, a lot of data. Thanks to the CDN and the huge storage services, cloud computing systems provide, static files are no longer an important part of our problem ...

The real thing is web page rendering. We thought above that our web servers are very lightweight, universal interfaces for our database. We have not yet decided how to run applications in our universes. Now it's time to do it.

Each request of our system will be sent to the site and processed by the application launched for this site. The very first thing that our web servers will do is decide which site the request belongs to. On our database server, we save a table that maps host names to sites. On each new client website, we will add one or more domains to this table to match this site. With each request to our web servers, we will query the database server and decide which site to load. Good?

No, it's not good. This is terrible. Why?

Big numbers, small numbers

We have a small number of websites; but a very large number of requests. The number of websites in a universe changes much less frequently than other types of data, such as comments on blog sites. This table is updated, perhaps several times a day, in the established universe. Requesting such a tiny (several thousand records, tiny!) Database for each query again and again all day is not smart. The smart way to do this is to keep copies of this table on web servers and only update after they are updated. How do we know when the list of sites is updated? We can save the row with the number as the number of our table. With each update, we can increase this number. Or we can keep the timestamp of the last update. Web servers can check the database server for this number and compare it with their local versions in memory. If the table is newer, we pull out the data, again overwriting the local copy in memory. Thus, we will reduce thousands of queries to small numbers. Big numbers, small numbers ...

At that moment, what materials we use in our buildings began to make a difference. What languages, which database platforms and systems, etc. Now they matter because they can improve our work. For example, to update a table, our database server may have a mechanism for notifying web servers about the update. Thus, we will go even further and completely remove unnecessary queries in the table of domain sites. Thus, if the systems we have chosen provide such mechanisms, this means that these systems are a good choice for our architecture.

The separation of things in a rational way occurs automatically when we well understand what we want from our software. It is very difficult to scale database servers. Because we need data together. By increasing the number of web servers, we scale horizontally without any restrictions; but for a database server this is not applicable. The database server must have access to the data, and the machines have limitations that we cannot scale effectively.

Each database system provides scalability methods such as scalding or non-shared architecture. There may be time you should use; but, as I see it on forums, blogs and other places, people share their experiences, IMHO, people use it too aggressively and erroneously. They let their databases get bigger and bigger than "hey, it's time to scale, add a few fragments." 99% of all these applications are blind. People throw their problems into software and expect them to be solved like magic. Unfortunately, they very soon realize that there is no magic.

We must stay clear of blind decisions by observing our numbers: large numbers, small numbers. Also, understanding the internal operation of the system and solving problems using architecture, rather than the intensive use of materials.

Here is the architectural solution: Archived solution ( Calatrava ).

Here are other solutions that depend on materials instead of good architecture: [ Blind-run Solution 1 ], [ Blind-run Solution 2 ]

Judge for yourself the differences.

How can we scale the database server? Instead of blindly dividing the tables in the middle, we can revise our data. Can we share user account information with site templates? Sure why not? Can we use different database servers for old and fresh data? A bit more complicated, especially considering the search capabilities; but why not?

Separate mentally, not blindly! I agree that there will be times when you can no longer share it; but let’s how many of us work on Google or Facebook?

- Hey man, we have a very large dataset and when we run ...

- Shush. First go back and check your dataset. Should it really be a large dataset?

In most cases, no, it is not. We just don’t want to admit it ...

How to migrate

Restoring everything from scratch takes time, which many companies cannot afford. The best way is to architect our current system without overwriting each component; but instead, separating and redefining them as components. This is basically an analysis followed by small changes. Each function call in the system can easily be a division point. We can simply cut the system from this point into two parts.

A happy look at your current system for just a few hours will show you a ton of ideas on how to separate these parts. Once you have separated them, it is very easy to reverse engineer everything and then rebuild the new system in parts. If I have a building and I need to build a larger building on one land in order to build a new building without moving all the people who already live, there is a very difficult job; but not impossible. When it comes to software instead of buildings, it's a lot easier. So?

Relax

This is software. He is soft. You can copy your data, do tests on it, delete everything, copy another million times. Once your architecture is well designed, your mistakes never cause catastrophic events. It is very difficult to turn a 6-seat dining table into one that can serve 60 guests; but software ... software, and we can easily do such things. Relax.

- The above question concerns an area that cannot be covered in just a few paragraphs. Based on this part of the question: "However, I am still open to more general improvements, and not to those who are suitable for a wider audience." I tried to mention things in a general format, without going into details. Although I tried to give some tiny examples of practical applications of my principles, I know that in this short text I left a lot of open goals. I appreciate any criticism and questions in the comments.

+4
source share
 I'm interested in high level code and architecture changes required. 

Unfortunately, there is no right answer to the question of how you should change the architecture. The decision depends on how your current architecture looks, as well as what your capabilities and preferences are developers. Some autonomous systems may already have a relatively scalable platform, while others may need to make improvements as they begin to gain traction, while others may need to start from scratch because their code base is unsuitable.

A solid code base is EXTREMELY IMPORTANT. Without an efficient and clean code base, it is unlikely that your architecture will ever scale. Many companies make the mistake of putting in tape help after sexually assisted people to solve short-term problems, but in the end it never works. When something does not work correctly, take the time to fix it in the most logical way - even if it means setting up different code on your platform.

The best thing you can do is give you general recommendations on creating a scalable system, that is, use caching, develop your system for horizontal scaling, optimize your database, be sure to use db indexing wherever you need it. Some best practices are architecture dependent, but there are some general principles that must be followed by almost any scalable platform. For an in-depth study of good scaling techniques and design patterns, I would consider Scaling Rules: 50 principles for scaling websites .

As for the choice of platform, it is completely up to you and your preferences as a developer. What do you like to do? C #, Ruby, PHP? Go with the language and platform your team agrees to. I prefer Ruby on Rails, and I like the MVC design template, but that does not mean that this is the best solution for you. Go with what makes the most sense to you and work with it to develop a scalable system.

In the past, when I worked on systems that require high scalability, a point often arises where I found the need to start from scratch. Unfortunately, not everyone has the forethought to know all the best practices and functions that they will need, and often this leads to the creation of less ideal databases and platforms. The system development process gives an idea of ​​what is really required and what are the best methodologies for this system. Thus, in the past there were several times when I was halfway through the product and realized the need to create a new code base, so I start and port any old code that I think is suitable for the new design.

+3
source share

My case is somehow different, but it may be one of the models for switching from the desktop to Saas. My company is monitoring the media. Recently, we found that Media is no longer television and radio, and has moved to capture all streams from the network. To provide our customers with a solution - they need ARCHIVES, not RECORDERS - we simply place the solution for them on our servers.

This gave us the opportunity to have everything under one roof and maintain the code base in the "cloud HQ" directly.

There is something else, but I will not bore the readers, I will simply point out that we did not force ourselves to do this — it was really organic and perfectly normal.

The architecture of our solution follows one big premise: all node hardware added to the system will be used completely, from the network to the storage to the central processor. Each piece of software is recorded as a “task server” ↔ “agents” that run separately. Thus, you can always buy more cars and run everything you need at this moment.

+1
source share

Read the following: http://static.usenix.org/event/lisa07/tech/full_papers/hamilton/hamilton_html/index.html

This gives a good overview of building scalable systems. Both from the point of view of hardware / software, and with the help of a human scaling engineer to the server point of view.

Book (or memory book) Lean Startup (Eric Ries) also has some good pointers.

+1
source share

Processes basically create a Client / Server interface (http in SAAS web applications) based on interacting with your data ...

If you have direct access to your data on your server, you can transfer all or most of your software solution to a web platform such as asp.net, php, ruby ​​+ rails, python + django or others. In this alternative, you can transfer your data in several ways: JSON, oData, Text, embed code (objects or arrays), etc. There are very smart solutions to solve these problems. Typically, AJAX and the ubiquitous XMLHTTPRequest.

If in an extreme case, when you do not have the software code that you are trying to use, imagine some kind of COBOL or a similar solution in which you have only executable files ... Even in this extreme case, you can create a broker that is read from the screens of your program (auto-it can do this), transfer this data to your web interface, which will present it at the client endpoint, return the results from your web program and add them to the executable interface (auto - again or in which some other library have systematic way macros).

You do not need MVC / MVVC / RAILS / DJANGO or others, but they can make your life easier if you do not have specific experience in sharing data actions and managing the flow of web programs.

0
source share

All Articles