XAP

Broadcast Objects

For Stateful PUs, SpaceClosed Where GigaSpaces data is stored. It is the logical cache that holds data objects in memory and might also hold them in layered in tiering. Data is hosted from multiple SoRs, consolidated as a unified data model. object instances are partitioned across the cluster, by default.

GigaSpaces Objects contain data that can be used by multiple Processing UnitsClosed This is the unit of packaging and deployment in the GigaSpaces Data Grid, and is essentially the main GigaSpaces service. The Processing Unit (PU) itself is typically deployed onto the Service Grid. When a Processing Unit is deployed, a Processing Unit instance is the actual runtime entity..

There are two kinds of Space Objects: Standard Space Objects, and Broadcast Objects. They differ in how the data is distributed among the Partitions.

What is a Standard Space Object?

A Standard Object has its data split ("sharded") among the different partitions in the cluster. The sharding process spreads the data between the partitions according to the Object’s routingClosed The mechanism that is in charge of routing the objects into and out of the corresponding partitions. The routing is based on a designated attribute inside the objects that are written to the Space, called the Routing Index. key. Each piece of data is stored only once, in one of the partitions, and may be duplicated to replica partitions only.

In this example of a Standard Object Type, each partition holds an independent group of Object Instances. Thus, only 1/Nth of the data is located per each of the Processing Unit Instances (N = number of partitions).

What is a Broadcast Object?

A Broadcast Object is a Space Object Type that has its data duplicated among all partitions. Each Object Instance is repeated in every partition. The full object data is located in all Processing Unit instances.

In this example of a Broadcast Object, all 40 of the data items are colocated in all of the Processing Units.

What is Colocated Data and Processing?

When the data and the code running it are sharing the same JVMClosed Java Virtual Machine. A virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode., they are colocated. Colocated data access is several orders of magnitudes more efficient due to direct access that doesn’t require serialization, interrupts and network latencies.

When Should You Use the Default Standard Object?

A Standard Object makes sense when the data contained by the object is very large, or is frequently updated.

Since a given piece of data is located in only one place (in addition to possibly being located in a backup partition), maintaining data integrity is straightforward. The data is updated once, and all Processing Unit instances will automatically see the same data.

The disadvantage is that since the data is sharded, the code in a particular Processing Unit instance may have to retrieve data that is located in a different Processing Unit instance, which incurs additional overhead. This can be optimized by tuning the routing key.

When Should You Use a Broadcast Object?

A Broadcast Object is effective when a relatively small amount of infrequently-updated data is used by many Processing Unit instances (a “read-mostly” scenario).

Because the data is colocated to the code that is processing the data, there is no need to obtain data from a different partition. This reduces data shuffling latency and uses the Broadcast Object as co-located to the code running in the Processing Unit instance.

Replicated data requires a larger memory footprint, thus it is relevant for relatively small tables (of course, the bigger the table, the more memory it will consume in each partition). Replicated data must also be maintained in a consistent state in all the Processing Unit instances where it is deployed. This may require additional system overhead if the data is frequently updated.

How to Decide Which Type of Space Object to Use

The default option for Space Objects is the standard, sharded object.

A Broadcast Object may provide better overall system performance if the following conditions are met:

  • The data is accessed mostly by read operations (90% or more).

  • The data is infrequently updated (e.g. twice per day).

  • The data is accessed by a query or code that is optimized by use of colocated data. A typical situation is a SQL Join using a small, rarely-updated table.

How to Define a Broadcast Object

Java

To define a Broadcast Object in Java, add the “broadcast = true” property.

			
@SpaceClass(broadcast = true)
Public class MyBroadcastEntry {
 Public MyBroadcastEntry() {
 }
}
			
SpaceTypeDescriptorBuilder builder = new SpaceTypeDescriptorBuilder(typeName: “MyBroadcastDocument”);
builder.broadcast(true);
builder.create();

Ops Manager

A Broadcast Object can be defined using the One-Click Connect feature of Ops Manager by setting the “Broadcast Object” toggle.

When viewing a Broadcast Object in the Object Screen in Ops Manager, it will list it as a Broadcast Object under the Object Name.

Limitations

Defining a Broadcast Object in .NET Client SDK is not currently supported.

A transaction to write multiple mixed entries (broadcast and non-broadcast) is not allowed,

Explicit routing property, auto generated id, Take and Change are not allowed. Note that Take with null returns only non- broadcast entries.

A transaction that includes an operation that is related to a broadcast table is not supported.

Embedded operations will not propagate to all partitions and should be avoided