Tamia  Walter

Tamia Walter

1601396400

Bulk Updates with Optimistic Concurrency Control

In this blog we are going to focus on a scenario where you want to do many updates to vertices in a graph stored in Azure Cosmos DB using the Gremlin API, where each update needs to account for other updates that might occur at the same time.

A great feature about the Core (SQL) API in Azure Cosmos DB is that it is fully interoperable with the Gremlin API with respect to CRUD operations, which means you can use all of the powerful features in Core (SQL) API and it’s SDKs to manipulate vertices and edges in a graph.

A feature that has been added to the .NET SDK in Azure Cosmos DB since version 3 is bulk support, which we will also explore here. The bulk support feature in the SDK is a replacement for the older bulk executor library, and now fully supports all CRUD operations (insert, update, read, delete).

The full code sample for the below can be found here.

Bulk Scenario

Imagine you have a graph which models devices across a fleet of cars. Suppose you want to run a bulk operation to increase a temperature setting on each device by a certain amount for all devices in a particular fleet, but you are aware that independent operations could also be setting the temperature setting at the same time, and you want to make sure that this temperature state is not overwritten in your bulk update. In other words, you want to ensure all devices have their temperature setting increased by the same amount, relative to the value that was present in the database at the time of bulk update, without missing any interim updates. First, lets model the vertices in the graph as classes:

    public class VertexDevice
    {
        [JsonProperty("id")]
        internal string Id { get; set; }

        [JsonProperty("pk")]
        internal string pk { get; set; }

        [JsonProperty("label")]
        internal string label { get; set; }

        [JsonProperty("model")]
        public List<VertexProperty> model { get; set; }

        [JsonProperty("temp")]
        public List<VertexPropertyNumber> temp { get; set; }

        [JsonProperty("status")]
        public List<VertexProperty> status { get; set; }

        [JsonProperty("_rid")]
        internal string _rid { get; set; }

        [JsonProperty("_self")]
        internal string _self { get; set; }

        [JsonProperty("_etag")]
        internal string _etag { get; set; }

        [JsonProperty("_attachments")]
        internal string _attachments { get; set; }

        [JsonProperty("_ts")]
        internal string _ts { get; set; }
    }

    public class VertexProperty
    {
        [JsonProperty("id")]
        public string Id { get; set; }

        [JsonProperty("_value")]
        public string _value { get; set; }
    }

    public class VertexPropertyNumber
    {
        [JsonProperty("id")]
        public string Id { get; set; }

        [JsonProperty("_value")]
        public int _value { get; set; }
    }

#core (sql) api #gremlin api #tips and tricks #.net sdk #bulk delete #bulk insert #bulk reads #bulk support #bulk updates #etag #gremlin #optimistic concurrency #sql api

What is GEEK

Buddha Community

Bulk Updates with Optimistic Concurrency Control
Tamia  Walter

Tamia Walter

1601396400

Bulk Updates with Optimistic Concurrency Control

In this blog we are going to focus on a scenario where you want to do many updates to vertices in a graph stored in Azure Cosmos DB using the Gremlin API, where each update needs to account for other updates that might occur at the same time.

A great feature about the Core (SQL) API in Azure Cosmos DB is that it is fully interoperable with the Gremlin API with respect to CRUD operations, which means you can use all of the powerful features in Core (SQL) API and it’s SDKs to manipulate vertices and edges in a graph.

A feature that has been added to the .NET SDK in Azure Cosmos DB since version 3 is bulk support, which we will also explore here. The bulk support feature in the SDK is a replacement for the older bulk executor library, and now fully supports all CRUD operations (insert, update, read, delete).

The full code sample for the below can be found here.

Bulk Scenario

Imagine you have a graph which models devices across a fleet of cars. Suppose you want to run a bulk operation to increase a temperature setting on each device by a certain amount for all devices in a particular fleet, but you are aware that independent operations could also be setting the temperature setting at the same time, and you want to make sure that this temperature state is not overwritten in your bulk update. In other words, you want to ensure all devices have their temperature setting increased by the same amount, relative to the value that was present in the database at the time of bulk update, without missing any interim updates. First, lets model the vertices in the graph as classes:

    public class VertexDevice
    {
        [JsonProperty("id")]
        internal string Id { get; set; }

        [JsonProperty("pk")]
        internal string pk { get; set; }

        [JsonProperty("label")]
        internal string label { get; set; }

        [JsonProperty("model")]
        public List<VertexProperty> model { get; set; }

        [JsonProperty("temp")]
        public List<VertexPropertyNumber> temp { get; set; }

        [JsonProperty("status")]
        public List<VertexProperty> status { get; set; }

        [JsonProperty("_rid")]
        internal string _rid { get; set; }

        [JsonProperty("_self")]
        internal string _self { get; set; }

        [JsonProperty("_etag")]
        internal string _etag { get; set; }

        [JsonProperty("_attachments")]
        internal string _attachments { get; set; }

        [JsonProperty("_ts")]
        internal string _ts { get; set; }
    }

    public class VertexProperty
    {
        [JsonProperty("id")]
        public string Id { get; set; }

        [JsonProperty("_value")]
        public string _value { get; set; }
    }

    public class VertexPropertyNumber
    {
        [JsonProperty("id")]
        public string Id { get; set; }

        [JsonProperty("_value")]
        public int _value { get; set; }
    }

#core (sql) api #gremlin api #tips and tricks #.net sdk #bulk delete #bulk insert #bulk reads #bulk support #bulk updates #etag #gremlin #optimistic concurrency #sql api

I am Developer

1599275499

PHP Code for Update Data in MySQL Database - Tuts Make

php code for updating data in mysql database. Here, i will show you how to fetch and update data from mysql in php.

PHP Code for retrieve and update data form mysql database

  1. Step 1 - Connect to MySQL database
  2. Step 2 - Fetch data from the database
  3. Step 3 - Update data from database

https://www.tutsmake.com/php-code-for-update-data-in-mysql-database/

#how to edit data in php using form #how to update data in php using form mysqli #how to fetch and update data from database in php #php code for updating data in mysql database #php #update

Madelyn  Frami

Madelyn Frami

1598438700

10 Open Source/Commercial Control Panels For Virtual Machines (VM's) Management

Automatic creation and management of virtual machines is a topical issue for any company that provides VPS services. If you manage a large number of machines, a command line is definitely not the only tool you may need to perform various operations including client tasks, because such operations may be time-consuming.

In order to simplify routine tasks of server administrators and users, various companies develop control panels for virtual machines management, including interface-based solutions.

Don’t Miss20 Open Source/Commercial Control Panels to Manage Linux Servers

A control panel empowers you to perform any operation with a mouse click, whereas it would take you a good deal of time to complete the same task in the console. With a control panel, you will save your time and effort. However, it’s not all that simple.

Nowadays, VMmanager is the most popular software product for small and medium-sized businesses. VMware, in its turn, is a leading solution for large organizations. Both software products are commercial and rather expensive.

They deliver a large number of functions, however, some companies, especially, startups may need them. Besides, many of them cannot afford such an expensive product. For example, startups and companies in times of crisis may experience financial difficulties. Moreover, one can find interesting, outstanding solutions integrated with billing systems including tools for VM management.

How not to get lost among a great number of offers? We decided to help our users and wrote the following article, in which they will find answers to this question.

In this article, we will describe control panels for virtual machines management, both commercial and open-source, and help you choose the right solution to meet your personal needs.

1. VMmanager

VMmanager is one of the most popular commercial server virtualizations platforms based on QEMU/KVM technology. The solution has a reach feature set, that can suit both IT infrastructure owners and VPS services providers’ needs.

Virtual servers can be created within 2 minutes. Many routine tasks are performed automatically: including migration, cloning, reinstalling the OS, backups, adding and deleting interfaces, virtual server image creation, monitoring, statistics collection, server provisioning, etc.

The main advantages of VMmanager are:

  • Centralized management of various clusters.
  • Fault tolerance due to a microservice architecture.
  • Overselling, which helps to improve VPS provider’s equipment efficiency.
  • Complete control of the infrastructure thanks to a robust system of metrics collection.
  • A modern and intuitive interface.

VMmanager - Virtualization Management Platform

VMmanager – Virtualization Management Platform

2. VMware vSphere

VMware vSphere is the world’s leading server virtualization platform for building cloud infrastructure. With tons of its different powerful features, vSphere is a truely state-of-the-art software virtual machines management software. It is an ideal solution for large VPS providers with appropriate budgets and professional staff.

VMWare vSphere - Server Virtualization Platform

#control panels #virtualization #hosting control panel #linux control panels #virtual mahine control panels #linux

Joseph  Murray

Joseph Murray

1624006380

Understanding Control Structures in Java

As we know, a program consists of lists of instructions. Control structures are programming block that can change the path we take through those instructions or not. It is a syntactic form in a programming language to express flow of control.

In java and also in every other programming language there are three basic control structures:

  • Sequence Structure
  • Repetition Structure
  • Selection Structure

#programming #java #control #software-development #understanding control structures in java #control structures in java

Java Concurrency With Project Loom

Learn about Project Loom and the lightweight concurrency for JavaJVM.

Early Access: Java Concurrency With Project Loom

I am excited about Project Loom. The project focuses on easy to use lightweight concurrency for the JavaVM. Nowadays, the JavaVM provides a one java thread to one OS thread model to the programmer. While it’s actually the current Oracle implementation, it used to be that many JavaVM versions ago, threads provided to the programmer were actually green threads.

Project Loom goes down that road again, providing lightweight threads to the programmer. Those lightweight threads are mapped to OS threads in a “many-to-many” relationship.

The current implementation of light threads available in the OpenJDK build of the JDK is not entirely complete yet, but you can already have a good taste of how things will be shaping up.

In this article, we propose to put at tasks those threads to apply Origami image processing filters to a set of roughly 2000 images, and compare the time needed for each implementation to complete the processing of the whole set of (mostly cats) images.

MORE WORK? ™

The core of the work to apply to each file is basically three steps:

  • load an image
  • apply a filter to the image
  • save the image

#java #jdk #opencv #thread concurrency #origami #project loom #concurrency control