Fun IoT projects to do at home during #JulyOT

Fun IoT projects to do at home during #JulyOT

This article is contributed. See the original author and article here.

Like this wallpaper? Download it below!Like this wallpaper? Download it below!

 

As they find themselves spending more time at home, devs are finding creative ways to strike a new work-life balance using the Internet of Things. Here are the stories of three IoT hobbyists and their home projects that will inspire your creativity too.

 

IoT plant Sensor  – Jim Bennett (@JimBobBennett)

Jim Bennett’s AgroHack is made for the gardener at heart. In its most basic form, it combines a Raspberry Pi and a Grove moisture sensor to determine if his plants need water. Jim then sends this telemetry to Azure IoT Central and hooks this all up to an LED light so his potted rosemary plant can tell him when it is thirsty.

 

livelovegeek_0-1593562793067.jpeg

 

 

As useful as the device is for communicating with a house plant, Jim can also hook it up to Azure Stream Analytics in order to gather additional humidity, pressure, and temperature readings and compare these against official weather service forecasts. This way, if the tomatoes in his raised garden need water but the meteorological service says it will rain in the evening, Jim knows he doesn’t have to do anything about it.

This isn’t all Jim gets up to while getting creative with his at-home set-up. He also built his own home office IoT Busy light that uses Azure Logic Apps to talk to his Office 365 calendar so people in the house know when he is on a Teams call and needs a bit of quiet. He is also known for combining IoT and Ugly Sweaters, an underappreciated corner of the IoT.

If you want to build your own Agrohack, or see more of Jim’s cool projects, visit his blog.

 

IoT and barbeque – Cam Soper (@camsoper)

As great as IoT is for monitoring moisture, it also excels at monitoring heat levels. A good Kansas City barbecue should smoke for about five hours at a constant temperature of 225 degrees. But how do you keep your temperature constant?

Cam Soper hooked up a Raspberry Pi to his newly bought smoker and wrote Project Inferno, a C# app running on .NET Core, to automatically adjust the temperature. As any software developer knows, it makes more sense to learn a new technology and build a complex software solution to fix a hardware problem than to replace the hardware itself. ;)

 

livelovegeek_1-1593562793107.jpeg

 

Cam used Azure App Service, Azure Relay Hybrid Connections, and Azure Bot Service to make it easy to work with his device. Cam realized that using curl commands to control his invention would not appeal to the non-programmers in his family, so he created a bot interface that others could interact with when they wanted to set the barbecue temperature and monitor it. Cam even uses the Raspberry Pi’s CPU thermometer to check that the IoT device doesn’t overheat when the smoker is on and that it doesn’t get too cold when it starts to rain or snow.

 

IoT PresenceLight – Isaac Levin (@isaacrlevin)

Like many who work from home, Isaac wanted to find a better way to balance his work and home life. He needed to find a way to let his family know when he was on a call (and more importantly when he wasn’t) so they could go on living their lives without worrying about interrupting him. With the help of IoT, Isaac created a status light outside his home office door.

 

livelovegeek_2-1593562793126.png

 

Isaac Levin’s PresenceLight is coded around an interesting feature in Microsoft Teams known as Presence. It turns out that Presence, which is that red, yellow, and green indicator in your Teams that tells everyone if you are busy or not, is surfaced through Microsoft Graph APIs. Isaac created a .NET Core app to connect his own Outlook account to a LIFX IoT light outside his office door that effectively shows everyone in the house his Teams status. This is known in the IoT world as an “elegant solution.” Isaac found one piece of information he was interested in and created the shortest path to make his availability status known to the “” – aka his family. You can almost see the moment the lightbulb went on in his head.

For a more detailed walk through of how Isaac built this project, follow his blog

 

What’s next

When reading about home IoT projects, there’s a strong temptation to extend them or even combine them. Cam’s bot interface, for instance, would possibly be even more useful to his family if it were

If ideas are lighting up in your head right now, you may want to start by reading the guides each of these developers has written explaining the necessary IoT components and the required code (linked above). If you are fresh to the world of IoT, you can also get started with this Develop IoT solutions with Azure IoT Central on Microsoft Learn. And when you become a pro, be sure to take the Microsoft IoT Certification exam!

 

We want to hear about your own IoT explorations and ideas. Please share your home IoT projects using the hashtags #JulyOT and #IoTDevs. Being at home can be a great reason to do amazing things!

 

PS, looking for a new desktop wallpaper? We’ve got you covered! Download it below ⬇

 

 

 

Fun IoT projects to do at home during #JulyOT

Fun IoT home projects to do during #JulyOT

This article is contributed. See the original author and article here.

Like this wallpaper? Download it below!Like this wallpaper? Download it below!

 

As they find themselves spending more time at home, devs are finding creative ways to strike a new work-life balance using the Internet of Things. Here are the stories of three IoT hobbyists and their home projects that will inspire your creativity too.

 

IoT plant Sensor  – Jim Bennett (@JimBobBennett)

Jim Bennett’s AgroHack is made for the gardener at heart. In its most basic form, it combines a Raspberry Pi and a Grove moisture sensor to determine if his plants need water. Jim then sends this telemetry to Azure IoT Central and hooks this all up to an LED light so his potted rosemary plant can tell him when it is thirsty.

 

livelovegeek_0-1593562793067.jpeg

 

 

As useful as the device is for communicating with a house plant, Jim can also hook it up to Azure Stream Analytics in order to gather additional humidity, pressure, and temperature readings and compare these against official weather service forecasts. This way, if the tomatoes in his raised garden need water but the meteorological service says it will rain in the evening, Jim knows he doesn’t have to do anything about it.

This isn’t all Jim gets up to while getting creative with his at-home set-up. He also built his own home office IoT Busy light that uses Azure Logic Apps to talk to his Office 365 calendar so people in the house know when he is on a Teams call and needs a bit of quiet. He is also known for combining IoT and Ugly Sweaters, an underappreciated corner of the IoT.

If you want to build your own Agrohack, or see more of Jim’s cool projects, visit his blog.

 

IoT and barbeque – Cam Soper (@camsoper)

As great as IoT is for monitoring moisture, it also excels at monitoring heat levels. A good Kansas City barbecue should smoke for about five hours at a constant temperature of 225 degrees. But how do you keep your temperature constant?

Cam Soper hooked up a Raspberry Pi to his newly bought smoker and wrote Project Inferno, a C# app running on .NET Core, to automatically adjust the temperature. As any software developer knows, it makes more sense to learn a new technology and build a complex software solution to fix a hardware problem than to replace the hardware itself. ;)

 

livelovegeek_1-1593562793107.jpeg

 

Cam used Azure App Service, Azure Relay Hybrid Connections, and Azure Bot Service to make it easy to work with his device. Cam realized that using curl commands to control his invention would not appeal to the non-programmers in his family, so he created a bot interface that others could interact with when they wanted to set the barbecue temperature and monitor it. Cam even uses the Raspberry Pi’s CPU thermometer to check that the IoT device doesn’t overheat when the smoker is on and that it doesn’t get too cold when it starts to rain or snow.

To learn more about this or Cam’s other projects, please read his excellent blog

 

IoT PresenceLight – Isaac Levin (@isaacrlevin)

Like many who work from home, Isaac wanted to find a better way to balance his work and home life. He needed to find a way to let his family know when he was on a call (and more importantly when he wasn’t) so they could go on living their lives without worrying about interrupting him. With the help of IoT, Isaac created a status light outside his home office door.

 

livelovegeek_2-1593562793126.png

 

Isaac Levin’s PresenceLight is coded around an interesting feature in Microsoft Teams known as Presence. It turns out that Presence, which is that red, yellow, and green indicator in your Teams that tells everyone if you are busy or not, is surfaced through Microsoft Graph APIs. Isaac created a .NET Core app to connect his own Outlook account to a LIFX IoT light outside his office door that effectively shows everyone in the house his Teams status. This is known in the IoT world as an “elegant solution.” Isaac found one piece of information he was interested in and created the shortest path to make his availability status known to the “” – aka his family. You can almost see the moment the lightbulb went on in his head.

For a more detailed walk through of how Isaac built this project, follow his blog

 

What’s next

When reading about home IoT projects, there’s a strong temptation to extend them or even combine them. Cam’s bot interface, for instance, would possibly be even more useful to his family if it were

If ideas are lighting up in your head right now, you may want to start by reading the guides each of these developers has written explaining the necessary IoT components and the required code (linked above). If you are fresh to the world of IoT, you can also get started with this Develop IoT solutions with Azure IoT Central on Microsoft Learn. And when you become a pro, be sure to take the Microsoft IoT Certification exam!

 

We want to hear about your own IoT explorations and ideas. Please share your home IoT projects using the hashtags #JulyOT and #IoTDevs. Being at home can be a great reason to do amazing things!

 

PS, looking for a new desktop wallpaper? We’ve got you covered! Download it below ⬇

 

 

 

Plan Migrations to Azure VMware Solution

Plan Migrations to Azure VMware Solution

This article is contributed. See the original author and article here.

Azure Migrate now supports assessments for Azure VMware Solution, providing even more options for you to plan your migration to Azure. Azure VMware Solution (AVS) enables you to run VMware natively on Azure. AVS provides a dedicated Software Defined Data Center (SDDC) for your VMware environment on Azure, ensuring you can leverage familiar VMware tools and investments, while modernizing applications overtime with integration to Azure native services. Delivered and operated as a service, your private cloud environment provides all compute, networking, storage, and software required to extend and migrate your on-premises VMware environments to the Azure.  

 

Previously, Azure Migrate tooling provided support for migrating Windows and Linux servers to Azure Virtual Machines, as well as support for database, web application, and virtual desktop scenarios. Now, you can use the migration hub to assess machines for migrating to AVS as well.

 

With the Azure Migrate: Server Assessment tool, you can analyze readiness, Azure suitability, cost planning, performance-based rightsizing, and application dependencies for migrating to AVS. The AVS assessment feature is currently available in public preview.

 

This expanded support allows you to get an even more comprehensive assessment of your datacenter. Compare cloud costs between Azure native VMs and AVS to make the best migration decisions for your business. Azure Migrate acts as an intelligent hub, gathering insights throughout the assessment to make suggestions – including tooling recommendations for migrating VM or VMware workloads.

 

How to Perform an AVS Assessment

You can use all the existing assessment features that Azure Migrate offers for Azure Virtual Machines to perform an AVS assessment. Plan your migration to Azure VMware Solution (AVS) with up to 35K VMware servers in one Azure Migrate project.

  • Discovery: Use the Azure Migrate: Server Assessment tool to perform a datacenter discovery, either by downloading the Azure Migrate appliance or by importing inventory data through a CSV upload. You can read more about the import feature here.
  • Group servers: Create groups of servers from the list of machines discovered. Here, you can select whether you’re creating a group for an Azure Virtual Machine assessment or AVS assessment. Application dependency analysis features allow you to refine groups based on connections between applications.
  • Assessment properties: You can customize the AVS assessments by changing the properties and recomputing the assessment. Select a target location, node type, and RAID level – there are currently three locations available, including  East US, West Europe and West US, and more will continue to be added as additional nodes are released.
  • Suitability analysis: The assessment gives you a few options for sizing nodes in Azure, between performance-based or as on-premises. It checks AVS support for each of the discovered servers and determines if the server can be migrated as-is to AVS. If there are any issues found, the assessment automatically provides remediation guidance.
  • Assessment and cost planning report: Run the assessment to get a look into how many machines are in use and what estimated monthly and per-machine costs will be in AVS. The assessment also recommends a tool for migrating the machines to AVS. With this, you have all the information you need to plan and execute your AVS migration as efficiently as possible.

 

Andrea_MS_0-1593551436638.png

 

Figure 1 Assessment and Cost Planning Report

Andrea_MS_1-1593551436682.png

 

Figure 2 AVS Readiness report with suggested migration tool

 

Learn More

Updating to Azure Functions v3 in Visual Studio

Updating to Azure Functions v3 in Visual Studio

This article is contributed. See the original author and article here.

1. Install .NET Core 3

Azure Functions v3 runs on .NET Core 3.

 

To install .NET Core 3, visit Download .NET Core.

 

I recommend selecting the latest LTS version. LTS stands for Long Term Support, meaning that Microsoft is committed to supporting  this specific version of .NET Core with bug fixes for approximately 2-3 years.

As of today, the current LTS version of .NET Core is .NET Core 3.1.

2. Update the CSPROJ

Let’s ensure our csproj file has been updated for Azure Functions v3.

We’ll need to set the following three things:

Here is an example from my GitTrends app: https://github.com/brminnick/GitTrends/blob/master/GitTrends.Functions/GitTrends.Functions.csproj

 

 

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>netcoreapp3.1</TargetFramework>
        <AzureFunctionsVersion>v3</AzureFunctionsVersion>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.1" />
    </ItemGroup>
    <ItemGroup>
        <None Update="host.json">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
        <None Update="local.settings.json">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
            <CopyToPublishDirectory>Never</CopyToPublishDirectory>
        </None>
    </ItemGroup>
</Project>

 

3a. (Visual Studio) Update Azure Functions Runtime

Note: If you’re using Visual Studio for Mac, skip to the next section

Let’s now install the Azure Functions Runtime for Visual Studio 2019

  1. In Visual Studio, select Create a new project

Visual Studio, Create New ProjectVisual Studio, Create New Project

 

2. In the Create a new project window, in the search bar, enter Functions

3. In the Create a new project window, in the search results, select Azure Functions

4. In the Create a new project window, select Next

 

Create a new Azure Functions ProjectCreate a new Azure Functions Project

 

5. In the Create a new Azure Functions Application window, stand by while it is “Getting information about the latest function tools…”

 

Screen-Shot-2020-02-12-at-3.31.53-PM

 

6. In the Create a new Azure Functions Application window, once the new tools have been downloaded, click Refresh

 

Screen-Shot-2020-02-12-at-3.33.24-PM

3b. (Visual Studio for Mac) Update Azure Functions Runtime

Note: If you are using Visual Studio on PC, you may skip this step

Let’s now install the Azure Functions Runtime for Visual Studio for Mac

  1. In the Visual Studio for Mac window, select New

2. In the New Project window, on the left-hand menu, under Cloud, select General

 

 

3. In the Configure you Azure Functions Project window, standby until it finishes installing the Azure Functions components

Update Functions RuntimeUpdate Functions Runtime

 

 

4. Conclusion

Updating to Azure Functions v3 requires a couple steps:

  • Installing .NET Core 3
  • Updating our csproj
  • Updating Visual Studio’s Azure Functions Runtime

If you’d like to see an existing Azure Functions project using v3, feel free to check the Azure Functions Backend in my GitTrends app: https://github.com/brminnick/GitTrends/tree/master/GitTrends.Functions

 

 

Connection Pooling for MySQL with the Heimdall Proxy

Connection Pooling for MySQL with the Heimdall Proxy

This article is contributed. See the original author and article here.

Background

 

In using databases as a key component of internet infrastructure, IT departments are finding unexpected problems in particular when using DBaaS (Database-as-a-Service).  One of these challenges is in connection management.  There are three areas where connection management can be a problem:

 

  1. CPU overhead when an application “thrashes” connections rapidly by opening, closing and authenticating connections;
  2. Memory overhead when applications hold open long-lived connections that are often idle, which would be better used as block cache or may require a larger instance size than CPU requirements dictate
  3. Noisy neighbor congestion for a multi-tenant database. Limiting the number of active connections on a per-customer basis ensures fairness.

 

 

Solution

 

The Heimdall Proxy was designed for any SQL database including Azure Database for MySQL and Azure SQL Data Warehouse (SQL DW) for connection pooling such as:

 

  1. General connection reuse: New connections leverage already established connections to the database to avoid connection thrashing. This results in  lower CPU utilization;
  2. Connection multiplexing: Disconnects idle connections from the client to the database, freeing those connections for reuse for other clients.  This dramatically reduces connection counts to the database, and frees memory to allow the database to operate more effectively;
  3. Tenant Connection Management: The combination of 1) Per-user and per database connection limiting and 2) Multiplexing control the number of active queries a particular tenant can use at a time. This protects database resources and helps ensure the customer SLA (Service-level Agreement) is met and not disrupted by a busy neighbor using the same database.

 

Roland Lee_0-1593481387268.png

 

Figure 1: Heimdall Proxy Architecture Diagram

 

The Heimdall Proxy provides better control over database resources, providing more efficient and consistent behavior. As a result, users will reduce their database instance size and/or support higher customer density on the same database.  In this blog, we explain how these functions work and are configured.

 

 

Basic Connection Pooling

 

A basic connection pooler opens a number of connections upfront (the pool), then as an application needs a connection, instead of opening a new connection, it simply borrows a connection from the pool and returns it as soon as it is not needed.  For most pools to be effective:

  • The application is aware pooling will be used, and does not leave connections idle, but instead opens and closes them as needed;
  • All connections leverage the same properties, such as the database user and catalog (database instance);
  • State is not changed on the connection.

For a typical application server environment (e.g. J2EE), basic pooling is supported.  In other environments, where pooling was not part of the initial design, simply inserting a connection pooler can cause more overhead than expected:

  • When multiple users are connecting, and each user rarely uses more than a few connections (e.g. Data Analytics):  This may open a set of connections per user or close connections that are retrieved from the pool that do not match the desired properties and open new ones. This results in a large amount of connection thrashing (e.g. Apache Tomcat pooling and most other poolers). 
  • When many catalogs are used: In order to avoid changing the connection state, a discrete pool per catalog is created allowing an appropriate connection to be reused. This avoids triggering a USE statement before each new request.
  • When attempting to constrain total connections to the database and on a per-user basis

 

Roland Lee_1-1593481387368.png

 

Figure 2: Basic Connection Pooling 

 

For basic connection pooling, an active (green) front-side connection is paired with a back-side connection as shown in Figure 2 above. Additionally, you may have idle (red), unassigned connections in the backend for new connections. As such, you are NOT reducing the total number of connections, but are reducing the thrashing that occurs as the connections are opened and closed.  The main benefit of basic pooling is lower CPU load.

To configure connection pooling on Heimdall Central Console, select the Data Source tab. Click the checkbox to turn on Connection Pooling showed below:

 

Central Console Connection Pooling.v2.png

 

Connection Multiplexing

 

Beyond basic pooling, there is connection multiplexing, which does not associate a client connection with a fixed database connection. Instead, active queries or transactions are assigned to an existing idle database connection, or else a new connection will be established. If a client connection is idle, no resources are used on the database, reducing connection load and freeing memory. Shown in Figure 3 below, only active connections (green) are connected to the database via the connection pool while the idle connections (red) are ignored. 

 

Roland Lee_3-1593481387272.png

 

Figure 3:  Connection Multiplexing 

 

Multiplexing is a much more complicated technology than basic pooling. Therefore, many factors need to be accounted for.  In the following situations, multiplexing will halt, and a connection will remain pinned, including:

  1. If a transaction starts, then the connection mapping will remain until the transaction completes with a commit, rollback, or the client connection is terminated;
  2. If a prepared statement occurs on a connection, this makes the connection stateful, and will remain pinned to the database until the connection is terminated;
  3. If a temporary table is created, the connection will remain pinned until the table is deleted.

To configure multiplexing on the Heimdall Central Console, go to the VirtualDB tab. And under Proxy Configuration, just click Multiplex option shown below:

 

Roland Lee_4-1593481387283.png

 

In the event that special queries break multiplexing logic, and multiplexing needs to be disabled on the connection, go to the Rules tab for more granular control (along with other pool behaviors). For example, you can add the below rules to:

  1. Disable multiplexing when locking tables
  2. Enable multiplexing when unlocking tables

Central Console Pooling MySQL Granular Rules.v3.png

 

Tenant Connection Management

 

The third use-case helps ensure SLAs by enforcing per-tenant limits on connections and when combined with multiplexing, total active queries.  This prevents one user from saturating the database, ensuring fairness of resources for others.  A second tier of pool management is activated, that of “user pools”.  

In the Data Sources tab, the pool can be managed at two tiers: the user level and the database.  You can limit each user to a number of total connections and idle connections. Use the Roland Lee_6-1593481387280.png icon to add limits as shown below:

 

Roland Lee_7-1593464322737.png

 

Shown above, the total connections allowed to the database across all users is 1000, but each user is only allowed 100, and of those, only 10 can be idle.  Excess idle connections will be disposed of. Each time a connection is returned from the pool, there is a chance the connection will be closed: A value of 1000 means that there is a 1/1000 chance that the connection will be closed. This behavior is different from most connection poolers that set an absolute connection age which for large deployments can result in a stampede of many connections closing and reopening at once.

 

Roland Lee_8-1593481387288.png

 

Figure 4:  Multi-tenancy with Pooling, Multiplexing and Per-tenant connection limits

 

Figure 4 shows two tenants (with unique usernames or catalogs), allowing only active connections (green) to the database when multiplexing is enabled.  If Tenant A attempts to perform a third query (blue) while two are active, it will be queued until one of the current active queries completes.

The net result of the combination of 1) Pooling and 2) Multiplexing, and 3) Per-tenant limits is that no single tenant can saturate database capacity, resulting in the SLAs of other customers failing.  Further, as beyond a certain point, adding execution threads to the database will result in negative performance. This control can improve overall performance in many cases, allowing more capacity during peak load.

 

 

Use Cases

 

Magento

Magento is an e-commerce package written in PHP.  Since PHP does not support efficient connection pooling due to its processing model, each page-view opens a connection to the database, requests all the data it needs, then closes the connection.  For every page-view, it results in a very high amount of connection thrashing against the database and can consume a large percentage of the database CPU.  With the Heimdall proxy, basic connection pooling alone can reduce the load on the database by up to 15% percent.  

 

Slatwall Commerce

Slatwall is an eCommerce platform written in Java, and is natively designed to use pooling.  Although, under heavy load, it can result in the saturation of the allowed connections on MySQL (at most 7000).  In order to support larger user-loads, the Heimdall proxy can reduce the connection load by an order of magnitude, resolving connection limits on the database, and allowing the CPU load to be the limiting factor in larger deployments.  Per the developer of Slatwall, connection offload with multiplexing and pooling resulted in a 10x reduction in connections to the database.

 

 

Complementary Features

 

While Heimdall proxy provides connection management for databases, there are other features provided that further improve SQL scale, performance and security:

 

  1. Query Caching: The best way to lower database CPU is to never issue a query against the database in the first place.  The Heimdall proxy provides the caching and invalidation logic for Amazon ElastiCache as a look-aside results cache. It is simple way to improve RDS scale and improve response times without application changes;

 

  1. Automated Read/Write split: When a single database becomes too expensive to upgrade, or there is already a standby reader that is sitting idle, separating read and write queries can be used to offload write queries to an alternate server, improving resource utilization. Moreover, replication lag detection is supported to ensure ACID compliance.

 

  1. Active Directory/LDAP integration: By authenticating against LDAP, the Heimdall proxy manages connections for a large number of users, and synchronizes the authentication credentials into the database.  In environments that require database resources to be accessible to many users in the enterprise, while providing data security, this feature is easy to administer, while preventing individual users from over-taxing resources.

 

 

Next Steps

 

Deployment of our proxy requires no application changes, saving months of deployment and maintenance. To get started, you can download a free trial on the Azure Marketplace, or contact Heimdall Data at info@heimdalldata.com

 

 

Resources

 

 

Heimdall Data, a Microsoft technology partner, offers a database proxy that intelligently manages connections for SQL databases. With the Heimdall’s connection pooling and multiplexing feature, users can get optimal scale and performance from their database without application changes.