Skip to content
GigaSpaces Logo GigaSpaces Logo
  • Products, Solutions & Roles
    • Products
      • InsightEdge Portfolio
        • Smart Cache
        • Smart ODS
        • Smart Augmented Transactions
        • Compare InsightEdge Products
      • GigaSpaces Cloud
    • Solutions
      • Industry
        • Financial Services
        • Insurance
        • Retail and eCommerce
        • Telecommunications
        • Transportations
      • Technical
        • Operational BI
        • Mainframe & AS/400 Modernization
        • In Memory Data Grid
        • Transactional and Analytical Processing (HTAP)
        • Hybrid Cloud Data Fabric
        • Multi-Tiered Storage
        • Kubernetes Deployment
        • Streaming Analytics for Stateful Apps
    • Building a Successful Hybrid and Multicloud Strategy
      vid-icon Guide

      Learn how to build and deploy a successful hybrid and multicloud strategy to achieve: agility and scalability, faster go-to-market, application acceleration, legacy modernization, and more.

      DOWNLOAD
    • Contact
    • Try Free
  • Resources
    • Resource Hub
      • Webinars
      • Demos
      • Solution Briefs & Whitepapers
      • Case Studies
      • Benchmarks
      • ROI Calculators
      • Analyst Reports
      • eBooks
    • Featured Case Studies
      • Mainframe Offload with Groupe PSA
      • Digital Transformation with Avanza Bank
      • High Peak Handling with PriceRunner
      • Optimizing Business Communications with Avaya
    • col3
      • Blog
      • Technical Documentation
    • Live Webinar: Enable Digital Transformation With a High Performing Data Platform
      article-icon Live Webinar | March 11 - 9 AM EST/3 PM CET

      Join Capgemini and GigaSpaces for a discussion on the latest modernization trends for enterprises that are embarking on digital and business transformation

      REGISTER NOW
    • Contact Us
    • Try Free
  • Company
    • Col1
      • About
      • Customers
      • Management
      • Board Members
      • Investors
      • Events
      • News
      • Careers
    • Col2
      • Partners
      • OEM
      • System Integrators
      • Technology Partners
      • Value Added Resellers
    • Col3
      • Support & Services
      • University
      • Services
      • Support
    • GigaSpaces is Headed to CDAO 2021
      article-icon Event | March 2-4

      Join us at CDAO 2021, the premier Virtual Summit for Data and Analytics Leaders. We'll be moderating "Transforming Financial Services to a Customer-Centric Business", alongside USAA Bank, Regions Bank, and Capital Group.

      SIGN UP NOW
    • Contact Us
    • Try Free
  • Search
  • Contact Us
  • Try Free

REST Data Service Over In-Memory Data Grid

Subscribe to our blog!

Subscribe for Updates
Close
Back

REST Data Service Over In-Memory Data Grid

Yohana Khouryh June 2, 2016
4 minutes read

Applications are written in diverse and often remote environments. Storing and accessing data needs to be simple and portable, which is why REST (representational state transfer) is often the go-to protocol for web services.
And yet, using REST for data services can pose a number of challenges:

  • Performance (clients should be able to quickly access data and serve as many clients as possible. The packet should be efficient and small)
  • Query Semantics (there needs to be a simple and uniform interface that is acceptable on REST)
  • Support for Portable and Unstructured Data Formats (Documents)

Re-Thinking REST
As such, REST is best used in conjunction with other protocols. For low latency access the native protocol can be used, and for other cases REST can be used.
Let’s say that you have a client and a server. You want them to communicate. Usually every server provides an API that the client can use to get rid of excess data on the server. If it’s Java, it will use a protocol which is native for Java and it will likely not use REST as the native protocol will likely be faster.
Some applications use more than one source for their data, however. One could provide the Java API and another one will have another API. When all of these APIs could use REST, it makes things easier on the developer because it is all one uniform protocol. REST is an easy protocol which can work on any platform.
Going Mobile
Most mobile web-service applications are remote and performance is handled in other forms such as batching or remoting. The client is the mobile application, and the server is located in another country or across the world.
Accessing the REST API on the server side is called the remote. Instead of sending one JSON (object) at a time, you then have the ability to send a collection of objects so that the server can handle it all together. You are able to execute a remote task, you can define that task in your application, and you can send it to the server so that the server executes the entire task.
Data as a Service with XAP
Here at GigaSpaces, we designed the REST interface with XAP so that REST can be deployed with XAP. Through XAP, the REST service can accept JSON formats. XAP also has “documents” (a Java object/key value) which is dynamic, meaning that you can add dynamic properties so that the REST API can accept documents.


Let’s take a look at the code:
Request Schema:
{
 “idProperty”: { //required
   “propertyName”: “id”,
   “autoGenerated”: true, // optional
   “indexType”: “BASIC” // optional, use with autoGenerate. SEE com.gigaspaces.metadata.index.SpaceIndexType
 },
 “routingProperty”: {
   “propertyName”: “id”,
   “indexType”: “BASIC” // optional. SEE com.gigaspaces.metadata.index.SpaceIndexType
 },
 “fixedProperties”: [
   {
     “propertyName”: “id”,
     “propertyType”: “int32” // predefined types or full Java class path*
},
{
     “propertyName”: “prop1”,
     “propertyType”: “string”, // predefined types or full Java class path*
     “documentSupport”: “DEFAULT” // optional. SEE com.gigaspaces.metadata.SpaceDocumentSupport
},
{
     “propertyName”: “prop2”,
     “propertyType”: “java.util.Map”, // predefined types or full Java class path*
     “documentSupport”: “DEFAULT”, // optional. SEE com.gigaspaces.metadata.SpaceDocumentSupport
     “storageType”: “DEFAULT” // optional, use with documentSupport. SEE com.gigaspaces.metadata.StorageType
},
{
     “propertyName”: “indexedProp”,
     “propertyType”: “string”, // predefined types or full Java class path*
     “indexType”: “BASIC”, // optional. SEE com.gigaspaces.metadata.index.SpaceIndexType
     “uniqueIndex”: true // optional, must be used with indexType field only. Default to false.
}
 ],
 “compoundIndex”: {
“paths”: [
     “prop1”,
     “prop2”
],
   “unique”: true // optional
 },
 “fifoSupport”: “DEFAULT”, // SEE com.gigaspaces.annotation.pojo.FifoSupport
 “blobStoreEnabled”: true,
 “storageType”: “DEFAULT”, // SEE com.gigaspaces.metadata.StorageType
 “supportsOptimisticLocking”: true,
 “supportsDynamicProperties”: false // optional, default to true
}

Write

Description Write single entry to the space.
Request URL POST http://localhost:8080/{Type}/
Request Headers Content-Type: application/json
Request Body JSON object representation of a SpaceDocument object.

Response Schema:
{
  “status”:”success”
}
Examples:
curl -XPOST -H “Content-Type: application/json” -d ‘{“id”:1, “name”:”myName”, “age”:10}’ http://localhost:8080/MyObject

Write Multiple

Description Write multiple entries to the space.
Request URL POST http://localhost:8080/{Type}/
Request Headers Content-Type: application/json
Request Body JSON array representation of a SpaceDocument objects.

Response Schema:
{
  “status”:”success”
}
Examples:
curl -XPOST -H “Content-Type: application/json” -d ‘[{“id”:2, “name”:”John”, “age”:16},
{“id”:3, “name”:”Michael”, “age”:18}]’ http://localhost:8080/MyObject
Using XAP with REST
Deploying XAP with the REST interface means that there is support for non Java and .Net clients. It supports mobile apps and it provides support for remote apps which are running outside of the firewall. Finally, other apps can be easily integrated. Data can be seamlessly exchanged and the REST API makes XAP usable with modern microservices and cloud native apps.

CATEGORIES

  • Application Performance
  • application scalability
  • applications
  • Big Data
  • BigData
  • data
  • Data Grid
  • database
  • databases
  • Datacenter
  • distributed
  • distributed cache
  • distributed computing
  • event stream processing
  • GigaSpaces
  • Grid
  • High Availability
  • IMC
  • Java
  • low latency
  • Real Time Analytics
  • real-time
  • RealTime Analytics
  • Scalability
  • Scalable Architecture
  • XAP
Yohana Khouryh

All Posts (1)

YOU MAY ALSO LIKE

February 4, 2015

Achieving 100% Uptime and 139%…
8 minutes read

February 9, 2009

Ultra-Scalable and Blazing-Fast: The Sun…
4 minutes read

October 29, 2008

Need scalability? Don't forget pricing
5 minutes read
  • Copied to clipboard

PRODUCTS, SOLUTIONS & ROLES

  • Products
  • Smart Cache
  • Smart Operational Data Store
  • Smart Augmented Transactions
  • GigaSpaces Cloud
  • Roles
  • Architects
  • CIOs
  • Product Team
  • Solutions
  • Industry
    • Financial Services
    • Insurance
    • Retail and eCommerce
    • Telecommunications
    • Transportation
  • Technical
    • Operational BI
    • Mainframe & AS/400 Modernization
    • In Memory Data Grid
    • HTAP
    • Hybrid Cloud Data Fabric
    • Multi-Tiered Storage
    • Kubernetes Deployment
    • Streaming Analytics for Stateful Apps

RESOURCES

  • Resource Hub
  • Webinars
  • Demos
  • Case Studies
  • Solution Briefs & Whitepapers
  • Benchmarks
  • Cost Reduction Calculators
  • Analyst Reports
  • eBooks
  • Blogs
  • Documentation
  • Featured Case Studies
  • Mainframe Offload with Groupe PSA
  • Digital Transformation with Avanza Bank
  • High Peak Handling with PriceRunner
  • Optimizing Business Communications with Avaya

COMPANY

  • About
  • Customers
  • Management
  • Board Members
  • Investors
  • News
  • Events
  • Careers
  • Contact Us
  • Book A Demo
  • Try GigaSpaces For Free
  • Partners
  • OEM Partners
  • System Integrators
  • Value Added Resellers
  • Technology Partners
  • Support & Services
  • University
  • Services
  • Support
Copyright © GigaSpaces 2020 All rights reserved | Privacy Policy
LinkedInTwitterFacebookYouTube

Contact Us