NoSQL vs SQL: Understand the Differences and Make the Best Choice

nosql vs sql
NoSQL vs SQL
The tough choice of NoSQL vs SQL. An important decision for any business that may pay the price for down the road if you don’t plan accordingly. Here, we break down the important distinctions and discuss NoSQL vs SQL for you to make an informed decision.

What is NoSQL

NoSQL or Not Only SQL is an alternative to relational databases such as MySQL, Postgres, and SQL Server. Typically NoSQL databases are popular for working with large sets of data as data is stored in the form of flat collections so reading or writing operations is much faster. There is also less management for NoSQL databases as they support automatic repair, data distribution, and simpler data models. MongoDB, Couchbase, and Cassandra are popular NoSQL databases, but what do their queries look like? If NoSQL is all about leaving SQL behind, then what happens? These are fair questions, for example MongoDB uses its own syntax that kind of resembles JavaScript. Let’s take a look:
db.inventory.find( { status: "D" } )
In the above query the example selects from the inventory collection all documents where the status equals “D”. It is not too difficult to follow, but does feel a little foreign if you are used to SQL.

What is SQL

SQL or Structured Query Language is a language used in programming and designed for managing data held in a relational database management system. Some examples of popular SQL databases are Microsoft SQL Server, MySQL, and Postgres. One of many reasons for its popularity is how portable it is. SQL can be used in the program in PCs, servers, laptops, and even some of the mobile phones. Unlike NoSQL databases, SQL databases have an established, well defined standard. The language is also very straightforward, let’s take a look at it:
SELECT * FROM inventory WHERE status = "D"
In the above query the example selects from the inventory collection all documents where the status equals “D”. Sound familiar? That is because it is doing the same thing the MongoDB query is doing.

Which is Better?

This all depends on what your goals are. SQL databases tend to be beneficial for companies that have a clear business structure and do not plan on making many changes to their database structure. If your company has rapid growth or no clear schema definitions then a NoSQL database is the right choice for you. If you’re uncertain about which type of database is best for your business, you can schedule a consultation with one of our experts today.

What if you want to use a SQL database but not learn SQL or the opposite, use a NoSQL database without learning how to handle the data? That is where DreamFactory comes into play, interact with your data without having to learn SQL. In minutes generate an API from nearly any datasource that is fully documented and secure without code. Contact an expert today to learn how to cut development cost and time in half.

Monitoring APIs with Grafana

DreamFactory, Prometheus, Docker, and Grafana
DreamFactory, Prometheus, Docker, and Grafana
Now that we have explored monitoring apis with Prometheus, lets take a look at monitoring our APIs with Grafana. You may have noticed from the previous blog that Prometheus is awesome, but takes some time to fully flesh out and their dashboards aren’t the best. Good thing Grafana specializes in data visualization. We will not even have to configure all our Prometheus queries, so let’s get started.

Monitoring APIs with Grafana

We first need to confirm everything is running, if so your output should look similar to the above image. If you are not familiar with getting everything up and running please reference our previous blog. By navigating to 127.0.0.1:3000 you should see the Grafana home page. If you are not familiar with Grafana you may be wondering where the dashboards are. They are all located in the top left dropdown where we will see 4 pre-configured dashboards. Let’s review each of them to understand what each of them does.

Docker Host Dashboard

The Docker Host Dashboard shows metrics for monitoring the usage of the server. Thanks to dockerprom(link github repo) for pre-configuring all this we can now see:
  • Server uptime, CPU idle percent, number of CPU cores, available memory, swap and storage.
  • System load average graph, running and blocked by IO processes graph, interrupts graph.
  • CPU usage graph by mode (guest, idle, iowait, irq, nice, softirq, steal, system, user).
  • Memory usage graph by distribution (used, free, buffers, cached).
  • IO usage graph (read Bps, read Bps and IO time).
  • Network usage graph by device (inbound Bps, Outbound Bps).
  • Swap usage and activity graphs.
Monitoring APIs with Grafana

Docker Containers Dashboard

The Docker Containers Dashboard shows key metrics for monitoring running containers:
  • Total containers CPU load, memory and storage usage.
  • Running containers graph, system load graph, IO usage graph.
  • Container CPU usage graph.
  • Memory usage graph.
  • Cached memory usage graph.
  • Network inbound usage graph.
  • Container network outbound usage graph.
Monitoring APIs with Grafana

Monitor Services Dashboard

The Monitor Services Dashboard shows key metrics for monitoring the containers that make up the monitoring stack:
  • Prometheus container uptime, monitoring stack total memory usage, Prometheus local storage memory chunks and series.
  • Container CPU usage graph.
  • Memory usage graph.
  • Prometheus chunks to persist and persistence urgency graphs.
  • Chunks ops and checkpoint duration graphs.
  • Samples ingested rate, target scrapes and scrape duration graphs.
  • Alerts graph.
Monitoring APIs with Grafana

Conclusion

We now have a fully functioning monitoring tool with no code. Isn’t that awesome? A no code API tool and a no code data visualization tool, it can’t get much better than this. This post has only scratched the surface with regards to what you can accomplish with these tools. If you are interested in this for a Ruby application, check out our friends over at Scout who wrote a blog about doing exactly that. If you like what you see, sign up for a free trial today or contact us for more information!

Creating a Microsoft SQL Server API in Less Than 5 minutes with DreamFactory

DreamFactory and Microsoft SQL Server
DreamFactory and Microsoft SQL Server
Do you have a ton of data sources and do not know how to expose them? Do you know you need a SQL Server API but don’t know where to begin to build it? Look no further, DreamFactory can take any database and generate a fully documented and secure REST API faster than making a sandwich. All you need is your database credentials and DreamFactory will handle the rest, instantly generating Swagger documentation and securing your API by way of API keys. Follow along with the blog or our video below!

Installing DreamFactory

In order to get started you must install DreamFactory, which is Open Source and gives you the ability to try out a numerous amount of popular databases. To spin up your own hosted environment for free click here.

Generating the SQL Server API

Now the fun part. Once you have DreamFactory up and running you will be on the Admin panel. From there you will navigate to the Services tab to connect your database for your API. For example I have selected a Microsoft SQL Server database but it is nearly identical for any database you will be connecting to. Connecting your database typically only requires filling out these 5 fields as shown below.

SQL Server API

Upon saving there will be a success window pop-up saying “Service saved successfully”. What it doesn’t tell you is all the magic it just did behind the scenes. In just that short amount of time, it generated your REST API. So now if you navigate to the API Docs tab you can see your new documentation for the API and actually interact with it via the “Try it out” button.

SQL Server API

Securing and Interacting with the API

I can end it here now that you have generated your API, but where is the fun in that? Now let’s actually see the API in action! First things first, let’s generate an API key to be paired with the API for security purposes. DreamFactory does not allow access to the API without being authenticated. Let’s navigate to the Roles tab and create a Role for our API. This Role with correspond with the API key so different users can have different privileges based off different keys.

SQL Server API

For my Role I have pointed it to the SQL Server Service we just created and told it to only allow GET calls on the endpoints. This will ensure anyone using this API key will not be able to, for example delete data from the database. We must now link this Role to an API key. If we now go to the Apps tab we can create a new API key with the corresponding Role.

SQL Server API

Once we hit save we are able to see the API key generated for our use. Just to show how it works I will be using Insomnia, a popular HTTP service, to call our DreamFactory API. I will call the customers table, passing the API key in the headers for authentication.

SQL Server API

Conclusion

As you can see I have access to our new API and how much time did that take? Way less time than building this API yourself! If you would like to find out exactly how much time and money DreamFactory can save you, check out our API calculator. Otherwise what are you waiting for? Go build your next application using DreamFactory already! If you have any questions about the platform, or just APIs in general, we’d love to hear from you! Contact us.

API Calculator: Understanding the costs behind building an API-based application

Do you want to save money, deploy projects faster, and spend more time on developing application experiences that enthrall users? Then it’s practically a certainty APIs will play a critical role in your software development process. Accordingly, you’ll want to obtain a fairly accurate understanding of the cost and time required to building an API. But it’s important to understand that there’s much more to an API than just coding an interface to some data source such as a database. Whether you are planning on hiring a contractor or assign a new project to your team, an API calculator can help you understand the time and cost required to develop a mission-critical part of your next project. Continue reading “API Calculator: Understanding the costs behind building an API-based application”

What if Chuck Norris Wanted to Create a Service That Automated APIs?

chuck_facts-467532-edited

Chuck Norris Joke Enthusiasts Trust DreamFactory to Automate  APIs

Thanks to amusing Chuck Norris API database site The Internet Chuck Norris Database, you can have some fun and keep the Chuck Norris jokes flowing.  With the help of DreamFactory and our API automation tools, you will always have life-changing insights making those around you just a bit more intelligent, good looking and successful.  Who doesn’t need to understand such nuggets as:

Contrary to popular belief, the Titanic didn’t hit an iceberg. The ship was off course and ran into Chuck Norris while he was doing the backstroke across the Atlantic.

Continue reading “What if Chuck Norris Wanted to Create a Service That Automated APIs?”

The Reusable REST API Platform Strategy

The engineering team at DreamFactory designed and built some of the very first applications that use web services. Over the years, we learned many lessons trying to create the perfect mobile backend for these applications. This article lays out some of the problems companies encounter when they build custom REST APIs from scratch, and after that, we look at some of the architectural advantages and technical characteristics of a reusable REST API platform. The REST API Complexity Problem When a company decides to start a new mobile project, the IT group first defines the business requirements, and then starts writing the actual software. Usually there is a client-side team that designs the application and a server-side team that builds the backend infrastructure. These two teams must work together to develop a REST API that connects the backend data sources to the client application. One of the most time-consuming and expensive aspects of the development process is the “interface negotiation” that occurs between these two groups. With the acceptance of BYOD and general proliferation of mobile devices, the modern enterprise may need hundreds or even thousands of mobile applications. New mobile projects typically have new requirements that were not anticipated by the existing services. You could go back and try to expand the scope of the old services, but they are already in production, and so in many situations a new REST API is created for each new project. And so the API building process continues over time with various developers, consultants, and contractors. The REST APIs are often written with different tools and developer frameworks. They run on different servers or in the cloud. They are tied to different databases and file storage systems. Each new service has different security mechanisms, credential strategies, user management systems, and API parameter names, as this diagram illustrates. Continue reading “The Reusable REST API Platform Strategy”

DreamFactory hackathon with Verizon Cloud and Mapquest

DreamFactory partnered with Verizon and Mapquest to host an all day hackathon at the beautiful Verizon campus in Dallas,Texas filled with fun, food, drinks and prizes. The September hackathon hosted 76 developers coming from different career, education and programming backgrounds which fueled creativity, collaboration and ultimately the innovation that followed. Continue reading “DreamFactory hackathon with Verizon Cloud and Mapquest”

PHP 7 doubles performance for DreamFactory

speed-increase.png DreamFactory is a high performance request/response engine for REST API Services. You can hook up any SQL or NoSQL database and instantly get a comprehensive REST API for that data source. A big part of our platform is the support for JSON Web Tokens. JWT is an open standard for representing session information that is transferred between the client and server. JWT allows DreamFactory to run in a completely stateless manner, which makes the platform very easy to scale vertically with additional server capabilities or horizontally with multiple instances between a load balancer. Continue reading “PHP 7 doubles performance for DreamFactory”

How to integrate the Twilio API with DreamFactory to enable SMS for your app

twilio.png Twilio has a superb API for integrating SMS messages into your applications. It’s easy to add Twilio as a remote HTTP service to any application you’re building with DreamFactory. DreamFactory lets you securely store your Twilio authentication credentials, call the Twilio API directly from a DreamFactory session, and easily add role-based access control to any Twilio API endpoint. This brief tutorial shows you how to add Twilio to DreamFactory in five minutes.

Continue reading “How to integrate the Twilio API with DreamFactory to enable SMS for your app”

DreamFactory Cache Supports Redis, Memcached, and local storage

Redis
DreamFactory Redis
One of the most powerful features of DreamFactory is the ability to write server-side script in pre- and post-process events and use as a custom scripting service. This provides the ultimate flexibility and allows the platform to support all sorts of complex backend business logics. However, DreamFactory server-side scripts are stateless and their scope is gone once the original process is completed.

Supported Cache Services

To allow for more flexibility in server-side scripts as well as to add a quick way of storing key-value pair data, DreamFactory 2.3 introduces the ‘Cache’ service. The Cache service supports three different types of cache backends.

  • Local file based cache
  • Redis cache
  • Memcached cache
Once the services are configured, all three types of cache backends use the same REST API interface to read, write, update, and delete the key-value pair data. Cache Services are native services of DreamFactory and are supported by features like role-service-access, lookup usage, live API documentation etc.

You can configure and use a cache service in a standalone way to store any number of key-value pair and retrieve them as needed. This allows you to easily implement a server-side caching system for your client apps. But the real benefit of cache service can be realized in server-side scripting. In your DreamFactory server-side script, you can make API calls to your cache service just like you do that for any other services. This will allow you to temporarily or permanently store any data related to your script. This can later be used in another script/process or even inside your client application.

Configuring Your First Cache Service

Let’s take a closer look at this new Cache service and it’s usage. You can configure/provision a Cache service just like any other services using the DreamFactory Admin console -> Services tab.

To learn more about the configuration, please see the wiki page.

Once you configure a DreamFactory Cache service, head over to the swagger API Docs by selecting the ‘API Docs’ tab on the Admin console. Your newly provisioned Cache service should now show up on the list of services there. Select your cache service to expand it. This will show you all the available APIs for your service. You can expand each of this API to get further details on their usage.

Redis service in Swagger

Cache for Performance

If you are interested in getting your API calls in a timely manner you can leverage Redis for consistent speeds. To do so you just have to follow a few simple steps.

First you will want to enable Caching for the Service you would like cached and set the amount of time each cached response is allowed to last.

Redis

Then you will want to edit the Cache Settings section in your .env file. You will want to uncomment the following.

  • CACHE_DRIVER=redis
  • CACHE_DEFAULT_TTL=Cache TTL in minutes
  • CACHE_HOST=
  • CACHE_PORT=6379
  • CACHE_PASSWORD=LEAVE COMMENTED OUT IF YOU ARE NOT USING A PASSWORD
  • CACHE_DATABASE=2
  • REDIS_CLIENT=Which Redis client to use: predis or phpredis

Believe it or not, that Service is now being Cached. Confirm it in your Redis environment and never worry about slow response times again! Chat with an expert today or try out a free instance to see how easy it is yourself.