Skip to main content

Azure Development Environment - Costs and Optimization

Azure Development Environment Series:
The story started  in the moment when the team size started to increase. Working with a cloud solution like Azure requires you to be aware of the costs.
When I say costs I'm not referring to the cost of running of the system in cloud. Each environment that you need to have will generate an extra cost. This doesn't means that you shouldn't have multiple environments. But you should keep an eye on the costs and try to make a good estimation from the beginning.
In general you would have the following environments:
  • Development
  • Testing
  • Integration
  • Staging
  • Production
First of all, you might have different needs for each environment. For Development, Testing and Integration you don't need the same power (CPU, DB size and so on) like in Staging and Production. This means that you could have less resources allocated to them - less costs.
In general this should be true. The only thing that we didn't take into account in the above diagram is the team size. 
Why?
In general where you design a solution that runs on cloud, you will also use SaaS services like storage, database, cache and so on, not only PaaS services. This means, that each developer will require an isolated environment (extra cost for each developer).
Of course there are some services that you could 'share', once you have a stable wrapper over them. Services that can could be shared are storage accounts, Azure Redis Cache and other services. The exact services that you can share between developers may vary, based on what your system does and how you use cloud services. 
For example if you cannot configure or control two different instances of your application to store a specific information in the Azure Redis Cache with different key name, than you might not be able to share the cache layer. Similar thing is applicable to storage, DB, and so on. 

We can have a case, where your products requires two different databases for each instance of your product. This means that if you have 4 developers, than you would need 8 instances of SQL Azure. If you would have 10 developers, you would need 20 DBs.
The cheapest tier (DB size) that is available now is B (Basic), that costs 4.21EUR/M.
4 DEV x 2 DB x 4.21EUR/M = 33.64 EUR/M
10 DEV x 2 DB x 4.21EUR/M = 84.2 EUR/M 

But what if the Basic one cannot be used because you are missing some feature or, like in our case we need at least 3 DB instances. Things will be a little more complicated in this case. If you need at least S0, you will pay 376 EUR/M for 3 DB per developer (with 10 developers).
You might try to optimize the cost, buy using only one DB per developer or on DB for all the team, but it will not be so easy. When you have the tables with the same name on all 3 DBs than merging all of them in only one DB is not easily. A suffix could be used for each tables, based on where the table is (DB1, DB2, DB3), but you affect the table name and not all the time you want to do this.

Another solution that you might want to try is to use an Azure VM where you install SQL Server. Developers would be able to create as many databases they would want and you would pay only for VM (especially when you don't do to many actions at DB level and you already have a SQL Server licence). If you don't have you can use directly a VM with SQL Azure included (the licence price will be directly in the cost of VM. When you need more power, you can change the tier (size) of the VM.
A VM with 2 cores will cost you 97 EUR/M.
  
Conclusion
The best thing that you can do is to not optimize costs from this point of view. If you really need to do this try to share resources, but take into account that this might increase DEV environment complexity and decrease team productivity. 
If you need to optimize costs of DEV env. at DB level, I would try to suffix the DBs in a way that each developer would need only one DB instance. The last resort should be sharing the same DB between different developers or us a VM like in the above example.
Try to keep the env. as close as possible as in production. Try to keep the complexity of the DEV env. as low as possible.

Comments

Popular posts from this blog

How to check in AngularJS if a service was register or not

There are cases when you need to check in a service or a controller was register in AngularJS.
For example a valid use case is when you have the same implementation running on multiple application. In this case, you may want to intercept the HTTP provider and add a custom step there. This step don’t needs to run on all the application, only in the one where the service exist and register.
A solution for this case would be to have a flag in the configuration that specify this. In the core you would have an IF that would check the value of this flag.
Another solution is to check if a specific service was register in AngularJS or not. If the service was register that you would execute your own logic.
To check if a service was register or not in AngularJS container you need to call the ‘has’ method of ‘inhector’. It will return TRUE if the service was register.
if ($injector.has('httpInterceptorService')) { $httpProvider.interceptors.push('httpInterceptorService&#…

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

[Post-Event] Codecamp Conference Cluj-Napoca - Nov 19, 2016

Last day I was invited to another Codecamp Conference, that took place in Cluj-Napoca. Like other Codecamp Conferences, the event was very big, with more than 1.000 participants and 70 sessions. There were 10 tracks in parallel, so it was pretty hard to decide at  what session you want to join.
It was great to join this conference and I hope that you discovered something new during the conference.
At this event I talked about Azure IoT Hub and how we can use it to connect devices from the field. I had a lot of demos using Raspberry PI 3 and Simplelink SensorTag. Most of the samples were written in C++ and Node.JS and people were impressed that even if we are using Microsoft technologies, we are not limited to C# and .NET. World and Microsoft are changing so fast. Just looking and Azure IoT Hub and new features that were launched and I'm pressed (Jobs, Methods, Device Twin).
On backend my demos covered Stream Analytics, Event Hub, Azure Object Storage and DocumentDB.

Title:
What abo…