Distributed Computing With Go 1st Edition V.N. Nikhil Anurag download
Distributed Computing With Go 1st Edition V.N. Nikhil Anurag download
https://textbookfull.com/product/distributed-computing-with-
go-1st-edition-v-n-nikhil-anurag/
https://textbookfull.com/product/distributed-services-with-go-
your-guide-to-reliable-scalable-and-maintainable-systems-1st-
edition-travis-jeffery/
https://textbookfull.com/product/silicon-photonics-amp-high-
performance-computing-proceedings-of-csi-2015-1st-edition-anurag-
mishra/
https://textbookfull.com/product/distributed-computing-
pearls-1st-edition-gadi-taubenfeld/
https://textbookfull.com/product/internet-and-distributed-
computing-systems-giancarlo-fortino/
Beginning Jenkins Blue Ocean: Create Elegant Pipelines
With Ease 1st Edition Nikhil Pathania
https://textbookfull.com/product/beginning-jenkins-blue-ocean-
create-elegant-pipelines-with-ease-1st-edition-nikhil-pathania/
https://textbookfull.com/product/security-with-go-1st-edition-
john-daniel-leon/
https://textbookfull.com/product/distributed-computing-by-mobile-
entities-current-research-in-moving-and-computing-paola-
flocchini/
https://textbookfull.com/product/distributed-computing-and-
artificial-intelligence-12th-international-conference-1st-
edition-sigeru-omatu/
Distributed Computing with Go
BIRMINGHAM - MUMBAI
Distributed Computing with Go
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form
or by any means, without the prior written permission of the publisher, except in the case of brief quotations
embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented.
However, the information contained in this book is sold without warranty, either express or implied. Neither the
author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to
have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products
mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy
of this information.
ISBN 978-1-78712-538-4
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as
well as industry leading tools to help you plan your personal development and advance
your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos
from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a
print book customer, you are entitled to a discount on the eBook copy. Get in touch with us
at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters, and receive exclusive discounts and offers on Packt books and
eBooks.
Contributors
Jinzhu Zhang is a veteran coder, creator/contributor of many open source projects, such as
GORM. He is on Github at github.com/jinzhu.
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Table of Contents
secure/secure_test.go 192
Test results 194
Summary 195
Chapter 9: Foundations of Web Scale Architecture 196
Scaling a web application 197
The single server instance 197
Separate layers for the web and database 198
Multiple server instances 200
The load balancer 200
Multi-availability zones 202
The database 203
SQL versus NoSQL 204
Which type of database should we use? 204
Database replication 205
Master-replica replication 205
Master-master replication 209
Failover cluster replication 214
Monolith versus microservices 216
Mediator design pattern 217
Deployment options 219
Maintainability of multiple instances 220
Summary 221
Other Books You May Enjoy 222
Index 226
[ vi ]
Preface
The Go programming language was developed at Google to solve the problems they faced
while developing software for their infrastructure. They needed a language that was
statically typed without slowing down the developer, would compile and execute
instantaneously, take advantage of multicore processors, and make working across
distributed systems, effortless.
Chapter 4, The RESTful Web, provides all the context and knowledge required to start
designing and building REST APIs in Go. We will also discuss the interaction with a REST
API server using different available approaches.
Chapter 6, Goophr Concierge, dives deep into the first component of Goophr by describing in
detail how the component is supposed to work. These concepts are further driven home
with the help of architectural and logical flow diagrams. Finally, we'll look at how to
implement and test the component.
Chapter 7, Goophr Librarian, is a detailed look at the component that is responsible for
maintaining the index for the search terms. We also look at how to search for given terms
and how to order our search results and many more. Finally, we'll look at how to
implement and test the component.
Chapter 9, Foundations of Web Scale Architecture, is an introduction to the vast and complex
topic on how to design and scale a system to meet with the demands at web scale. We will
start with a single instance of a monolith running on a single server and scale it up to span
across multiple region, have redundancy safeguards to ensure that the service is never
down and many more.
[2]
Preface
Once the file is downloaded, please make sure that you unzip or extract the folder using the
latest version of:
The code bundle for the book is also hosted on GitHub at https://github.com/
PacktPublishing/Distributed-Computing-with-Go. In case there's an update to the code, it
will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at
https://github.com/PacktPublishing/. Check them out!
[3]
Preface
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames,
file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example,
"Now that we have all the code in place, let's build the Docker image using
the Dockerfile file."
package main
When we wish to draw your attention to a particular part of a code block, the relevant lines
or items are set in bold:
// addInt.go
package main
[4]
Preface
Bold: Indicates a new term, an important word, or words that you see on the screen, for
example, in menus or dialog boxes, also appear in the text like this. For example, "Select
System info from the Administration panel."
[5]
Preface
Get in touch
Feedback from our readers is always welcome.
General feedback: Email [email protected], and mention the book's title in the
subject of your message. If you have questions about any aspect of this book, please email
us at [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you have found a mistake in this book we would be grateful if you would
report this to us. Please visit, http://www.packtpub.com/submit-errata, selecting your
book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the internet, we
would be grateful if you would provide us with the location address or website name.
Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in
and you are interested in either writing or contributing to a book, please visit
http://authors.packtpub.com.
Reviews
Please leave a review. Once you have read and used this book, why not leave a review on
the site that you purchased it from? Potential readers can then see and use your unbiased
opinion to make purchase decisions, we at Packt can understand what you think about our
products, and our authors can see your feedback on their book. Thank you!
[6]
Developer Environment for Go
1
Go is a modern programming language built for the 21st century application development.
Hardware and technology have advanced significantly over the past decade, and most of
the other languages do not take advantage of these technical advancements. As we shall see
throughout the book, Go allows us to build network applications that take advantage of
concurrency and parallelism made available with multicore systems.
In this chapter, we will look at some of the topics required to work through rest of the book,
such as:
GOROOT
In order to run or build a Go project, we need to have access to the Go binary and its
libraries. A typical installation of Go (instructions can be found
at https://golang.org/dl/) on Unix-based systems will place the Go binary at
/usr/bin/go. However, it is possible to install Go on a different path. In that case, we need
to set the GOROOT environment variable to point to our Go installation path and also append
it to our PATH environment variable.
Developer Environment for Go Chapter 1
GOPATH
Programmers tend to work on many projects and it is good practice to have the source code
separate from nonprogramming-related files. It is a common practice to have the source
code in a separate location or workspace. Every programming language has its own
conventions on how the language-related projects should be set up and Go is no exception
to this.
GOPATH is the most important environment variable the developer has to set. It tells the Go
compiler where to find the source code for the project and its dependencies. There are
conventions within the GOPATH that need to be followed, and they have to deal with folder
hierarchies.
src/
This is the directory that will contain the source code of our projects and their
dependencies. In general, we want our source code to have version control and be hosted
on the cloud. It would also be great if we or anyone else could easily use our project. This
requires a little extra setup on our part.
pkg/
Go is a compiled programming language; we have the source code and code for the
dependencies that we want to use in our project. In general, every time we build a binary,
the compiler has to read the source code of our project and dependencies and then compile
it to machine code. Compiling unchanged dependencies every time we compile our main
program would lead to a very slow build process. This is the reason that object files exist;
they allow us to compile dependencies into reusable machine code that can be readily
included in our Go binary.
[8]
Developer Environment for Go Chapter 1
These object files are stored in $GOPATH/pkg; they follow a directory structure similar to
that of src/, except that they are within a subdirectory. These directories tend to follow the
naming pattern of <OS>_<CPU-Architecture>, because we can build executable binaries
for multiple systems:
$ tree $GOPATH/pkg
pkg
└── linux_amd64
├── github.com
│ ├── abbot
│ │ └── go-http-auth.a
│ ├── dimfeld
│ │ └── httppath.a
│ ├── oklog
│ │ └── ulid.a
│ ├── rcrowley
│ │ └── go-metrics.a
│ ├── sirupsen
│ │ └── logrus.a
│ ├── sony
│ │ └── gobreaker.a
└── golang.org
└── x
├── crypto
│ ├── bcrypt.a
│ ├── blowfish.a
│ └── ssh
│ └── terminal.a
├── net
│ └── context.a
└── sys
bin/
Go compiles and builds our projects into executable binaries and places them in this
directory. Depending on the build specs, they might be executable on your current system
or other systems. In order to use the binaries that are available in the bin/ directory, we
need to set the corresponding GOBIN=$GOPATH/bin environment variable.
[9]
Developer Environment for Go Chapter 1
Package management
In the days of yore, all programs were written from scratch—every utility function and
every library to run the code had to written by hand. Now a days, we don't want to deal
with the low level details on a regular basis; it would be unimaginable to write all the
required libraries and utilities from scratch. Go comes with a rich library, which will be
enough for most of our needs. However, it is possible that we might need a few extra
libraries or features not provided by the standard library. Such libraries should be available
on the internet, and we can download and add them into our project to start using them.
In the previous section, GOPATH, we discussed how all our projects are saved into
qualified paths of the $GOPATH/src/git-server.com/user-name/my-go-
project form. This is true for any and all dependencies we might have. There are multiple
ways to handle dependencies in Go. Let's look at some of them.
go get
The go get is the utility provided by the standard library for package management. We
can install a new package/library by running the following command:
$ go get git-server.com/user-name/library-we-need
This will download and build the source code and then install it as a binary executable (if it
can be used as a standalone executable). The go get utility also installs all the
dependencies required by the dependency retrieved for our project.
The go get utility is a very simple tool. It will install the latest master
commit on the Git repository. For simple projects, this might be enough.
However, as projects start growing in size and complexity, keeping track
of the version of dependency being used might become critical.
Unfortunately, go get is not great for such projects, and we might want
to look at other package management tools.
[ 10 ]
Developer Environment for Go Chapter 1
glide
The glide is one of the most widely used package management tool in Go community. It
addresses the limitations of go get, but it needs to be installed manually by the developer.
The following is a simple way to install and use glide:
$ curl https://glide.sh/get | sh
$ mkdir new-project && cd new-project
$ glide create
$ glide get github.com/last-ent/skelgor # A helper project to generate
project skeleton.
$ glide install # In case any dependencies or configuration were manually
added.
$ glide up # Update dependencies to latest versions of the package.
$ tree
.
├── glide.lock
├── glide.yaml
└── vendor
└── github.com
└── last-ent
└── skelgor
├── LICENSE
├── main.go
└── README.md
In case you do not wish to install glide via curl and sh, other options are available and
described in better detail on the project page, available
at https://github.com/masterminds/glide.
go dep
The go dep is a new dependency management tool being developed by the Go community.
Right now, it requires Go 1.7 or newer to compile, and it is ready for production use.
However, it is still undergoing changes and hasn't yet been merged into Go's standard
library.
[ 11 ]
Developer Environment for Go Chapter 1
Structuring a project
A project might have more than just the source code for the project, for example,
configuration files and project documentation. Depending upon preferences, the way the
project is structured can drastically change. However, the most important thing to
remember is that the entry point to the whole program is through the main function, which
is implemented within main.go as a convention.
The application we will be building in this book, will have the following initial structure:
$ tree
.
├── common
│ ├── helpers.go
│ └── test_helpers.go
└── main.go
For example,
And so on.
Whenever we discuss code in any particular chapter, it is implied that we are in the
respective chapter's folder.
[ 12 ]
Developer Environment for Go Chapter 1
Containers
Throughout the book, we will be writing Go programs that will be compiled to binaries and
run directly on our system. However, in the latter chapters we will be using docker-
compose to build and run multiple Go applications. These applications can run without any
real problem on our local system; however, our ultimate goal is to be able to run these
programs on servers and to be able to access them over the internet.
During the 1990s and early 2000s, the standard way to deploy applications to the internet
was to get a server instance, copy the code or binary onto the instance, and then start the
program. This worked great for a while, but soon complications began to arise. Here are a
few of them:
Code that worked on the developer's machine might not work on the server.
Programs that ran perfectly on a server instance might fail upon applying the
latest patch to the server's OS.
For every new instance added as part of a service, various installation scripts had
to be run so that we can bring the new instance to be on par with all the other
instances. This can be a very slow process.
Extra care had to be taken to ensure that the new instance and all the software
versions installed on it are compatible with the APIs being used by our program.
It was also important to ensure that all config files and important environment
variables were copied to the new instance; otherwise, the application might fail
with little or no clue.
Usually the version of the program that ran on local system versus test system
versus production system were all configured differently, and this meant that it
was possible for our application to fail on one of the three types of systems. If
such a situation occurred, we would end up having to spend extra time and effort
trying to figure out whether the issue is specific to one particular instance, one
particular system, and so on.
It would be great if we could avoid such a situation from arising, in a sensible manner.
Containers try to solve this problem using OS-level virtualization. What does this mean?
[ 13 ]
Developer Environment for Go Chapter 1
All programs and applications are run in a section of memory known as user space. This
allows the operating system to ensure that a program is not able to cause major hardware or
software issues. This allows us to recover from any program crashes that might occur in the
user space applications.
The real advantage of containers is that they allow us to run applications in isolated user
spaces, and we can even customize the following attributes of user spaces:
However, how does this help us solve the problems we stated earlier? For that, let's take a
deeper look at Docker.
Docker
Modern software development makes extensive use of containers for product development
and product deployment to server instances. Docker is a container technology promoted by
Docker, Inc (https://www.docker.com), and as of this writing, it is the most predominantly
used container technology. The other major alternative is rkt developed by CoreOS
(https://coreos.com/rkt), though in this book, we will only be looking at Docker.
[ 14 ]
Developer Environment for Go Chapter 1
The biggest advantage of a VM is that we can run different types of OSes on a system, for
example, Windows, FreeBSD, and Linux. However, in the case of Docker, we can run any
flavor of Linux, and the only limitation is that it has to be Linux:
The biggest advantage of Docker containers is that since it runs natively on Linux as a
discrete process making it lightweight and unaware of all the capabilities of the host OS.
Understanding Docker
Before we start using Docker, let's take a brief look at how the Docker is meant to be used,
how it is structured, and what are the major components of the complete system.
The following list and the accompanying image should help understand the architecture of
Docker pipeline:
[ 15 ]
Developer Environment for Go Chapter 1
Docker daemon: This is the Daemon application that listens for commands to
manage building or running containers and pushing containers to Docker
registry. It is also responsible for configuring container networks, volumes, and
so on.
Docker images: Docker images contain all the steps necessary to build a
container binary that can be executed on any Linux machine with Docker
installed.
Docker registry: The Docker registry is responsible for storing and retrieving the
Docker images. We can use a public Docker registry or a private one. Docker Hub
is used as the default Docker registry.
Docker Container: The Docker container is different from the Container we have
been discussing so far. A Docker container is a runnable instance of a Docker
image. A Docker container can be created, started, stopped, and so on.
Docker API: The Docker client we discussed earlier is a command-line interface
to interact with Docker API. This means that the Docker daemon need not be
running on the same machine as does the Docker client. The default setup that we
will be using throughout the book talks to the Docker daemon on the local system
using UNIX sockets or a network interface:
Docker architecture
[ 16 ]
Developer Environment for Go Chapter 1
Let's try to dig deeper into details about our Docker installation:
$ docker info
Containers: 38
Running: 0
Paused: 0
Stopped: 38
Images: 24
Server Version: 17.12.0-ce
On Linux, when you try to run docker commands, you might get
Permission denied error. In order to interact with Docker, you can either
prefix the command with sudo or you can create a "docker" user group
and add your user to this group. See link for more details https://docs.
docker.com/install/linux/linux-postinstall/.
Let's try to run a Docker image. If you remember the discussion regarding the Docker
registry, you know that we do not need to build a Docker image using Dockerfile, to run a
Docker container. We can directly pull it from Docker Hub (the default Docker registry) and
run the image as a container:
$ docker run docker/whalesay cowsay Welcome to GopherLand!
[ 17 ]
Another Random Document on
Scribd Without Any Related Topics
leading downward. Gale listened intently and when she heard
nothing that indicated another’s presence, descended into the
passage. It was nothing like the big coal mines she had read and
seen pictures of. It was merely a tunnel that had been hewed out of
the ground with pick and shovel. If the ground had once held a
fortune of silver, it gave no evidence of it now. She had to stoop, so
low was the ceiling, as she picked her way along over rocks and
débris.
Suddenly the thin ray of light from her lamp wavered and she
noticed that it had grown dim. The battery was growing weak and
would not last much longer. She switched it off. She must save it so
she would have at least enough light to find her way back to the
entrance. That was where she made her mistake. Creeping along in
darkness, she did not see the black hole ahead and when her foot
touched empty air, fell head foremost down--down--several feet.
For a moment she lay stunned with the unexpectedness of her fall.
Too, the jar of landing had knocked all collected thought from her
head. Slowly she sat up and felt for an injury. Nothing but bruises,
thank goodness. She had dropped her flashlight and had to feel out
with her hands along the damp earth until she found it. She hoped
fervently that the drop had not put it entirely out of commission. No,
when she pressed the little button, a feeble ray of light shot out. The
light was bright enough to see that she had fallen into a pit of some
sort that stretched away out behind her into darkness which the
lamp would not penetrate.
She got to her feet and endeavored to shake some of the dirt from
her clothes. It was a risk to go forward without a light, but a glance
at the wall of dirt and rock had shown her that she could never hope
to climb up to where she had been before her fall. There was no
course but to explore this passage here and to hope that that
mysterious shadow did not decide to come back into the mine
immediately. But perhaps he had friends in here, friends that would
not welcome her intrusion. The very thought that any minute she
might stumble upon some mysterious, fearful unknown made her
nervous and she proceeded with greater caution.
Gale endeavored to readjust her sense of direction, which had been
somewhat confused with her fall, to find in what direction this
passage led. If she was correct, and she believed she was, it should
lead across to directly beneath the cabin where her friends were
sleeping. In that case, the man she had seen might have been the
“ghost” who with his mysterious knocks and screams had frightened
them. But, remembering the fall which she had had, how did he get
down to this lower passage, and once down here, how did he get up
again? She had not been able to find any means of gaining the
higher level. She halted and switched her flashlight on again. The
light was failing rapidly and she dared to keep it on only a moment.
But in that moment she had switched it overhead and seen the row
of four or five boards which she was sure were part of the floor of
the cabin. She sought a rock and hurled it up against the boards,
ducking as it rebounded back at her. She followed it with another
and then another.
“The ghost is back again,” said a nervous voice which she recognized
as Janet’s.
Certainly it was the floor of the cabin and she had discovered how
the ghost had done his mysterious knocking. His voice from here
would have been clearly audible to them, too, just as she could hear
the girls now.
“Gale’s gone!” she heard Valerie cry in alarm.
“Gone!” the others echoed.
She was just about to call out to reassure them when a sound in the
passageway behind her made her hold her breath in suspense.
Someone was coming along the tunnel. That must mean that the
mysterious ghost had returned to do some more of his haunting.
With quick and as quiet steps as possible, she retreated back the
way she had come, and directly toward that unknown. Standing
flattened against the earth wall, her heart thumping so she was sure
he would hear it, Gale waited for the ghost to pass her. He did so,
actually brushing against her in the darkness. He carried no
flashlight and it was this fact alone that had saved her from
discovery. Evidently he knew his way about in the darkness.
Aided now by fear, she sped along the narrow, low tunnel to where
she had had her fall. The man certainly had not been in here when
she fell, hence there must be some way he had entered since. She
had to find that entrance to gain her freedom. Now that the others
had discovered her absence, they would be alarmed and a search
would be begun. She must get back and reassure them. She must
also send Tom and Jim to find this mysterious stranger.
Flashing on the last faint rays of her flashlight, she saw the wall
down which she had fallen and against it hung a crude rope ladder.
So this was how he entered and left this lower tunnel! With one foot
on the ladder, she slipped her flashlight into her jacket pocket. It had
failed entirely now and she would have to depend on her memory to
lead her to the entrance. It took but a few moments to climb the
ladder and once at the top she pulled it up behind her. That would
keep the ghost in the lower passage until Tom and Jim could come
along and investigate him. There must be some reason why he
“haunted” the cabin with his mysterious knocks.
Swiftly as possible she went along the tunnel and after several
minutes stumbled against the steps leading up to the door.
Chapter VII
LANDSLIDE
“But I can’t understand how he got out!” Gale said again with a
puzzled frown. “I purposely pulled the ladder up behind me to keep
him in there.”
“There must be another way out that’s all,” Tom said.
“He’s gone and now we shall never know who the ghost was,” said
Janet.
Tom and Jim exchanged a fleeting glance that only Gale seemed to
see.
“Well, Gale gives a good imitation of a spook,” was Carol’s
declaration. “Imagine, throwing rocks at the floor to scare us all out
of our well earned sleep.”
“I was only demonstrating how it was done for my own satisfaction,”
Gale laughed.
The nine of them were jogging along on their horses. They had had
their breakfast while they discussed the disappearance of the ghost.
For the man whom Gale had thought imprisoned in the lower tunnel
had gone when Jim and Tom let themselves down on the rope
ladder. They had not explored the tunnel to its full length so they
were not sure, but they surmised that there must be another exit
some place along the passage and it was this that the mysterious
stranger had used. They had all endeavored to go back to sleep, but
their rest was fitful and broken. They had eaten an early breakfast
and now, two hours later, found them picking their way through
cactus and undergrowth to the distant hills.
“Git along little dogie, git along, git along,” Janet sang lustily.
“I wish I had brought some cotton,” Carol commented darkly, “for
my ears,” she added at Janet’s curious glance. “Then I wouldn’t have
to listen to you sing.”
“Oh, you don’t appreciate a good voice when you hear it,” was
Janet’s retort.
“A good voice, I do,” Carol declared, and moved her pony so that
Gale was between her and Janet. “But who ever told you----”
“What? Not another musical person?” Madge demanded as Tom
blew vigorously on his harmonica.
“If riding affects them like that,” Virginia laughed, “it is time we
called a halt. What do you say, Jim?”
“For ten minutes,” Jim nodded.
They fell from their mounts, grateful for the respite. Tom promptly
stretched out on the ground, his hat over his face to shut out the
sun. Jim led the horses to a little stream of water as the girls
stamped the stiffness out of their cramped legs.
“Where’s Jim?” Virginia wanted to know at the end of the allotted
ten minutes for Jim was not in sight. The horses were standing
ready for their riders, but they could not proceed without the guide.
Virginia went over and poked her brother into wakefulness.
“What’s the matter?” he asked drowsily.
“Jim hasn’t come back yet,” Virginia informed him, “and if we don’t
get started, we won’t make our next campsite before dark.”
Tom stretched lazily. “Well, stay here an’ I’ll find him.”
Gale and Virginia mounted their horses and the others did likewise.
“You know, I’m either going to wear the horse out or he is going to
wear me out,” Janet declared with a grimace as she lowered herself
into the saddle. “I’m afraid it is the latter.”
They waited for fully fifteen minutes before either Tom or Jim came
into sight. The horses had caught the impatience of their riders and
were fidgeting to be off.
“We thought you had deserted us for sure!” Virginia declared.
“Where were you?”
To Gale it seemed that the two men had the air of conspirators.
There was a gleam in their eyes that had not been there before. The
minute they came within earshot of the girls they stopped talking
and came on silently.
“Virginia,” Tom said immediately, “we want you to lead the girls to
Bear Rock and have lunch. Wait there for us.”
“But where are you going?” Virginia demanded.
“Jim has found a trail that looks strange so we are going to follow it,”
Tom explained. “But we’ll catch up to you at Bear Rock. You camp
there until we come, understand?”
“No,” Virginia said firmly. “I don’t understand. What is so strange
about this trail? Why can’t we all ride that way?”
“We couldn’t follow the trail with all of you along,” Tom declared. “It
would be obliterated in no time.”
“But, Tom, if we get lost up here we could never find each other
again,” Virginia continued.
“But Miss Virginia, you’ve been to Bear Rock lots of times,” Jim put
in. “Yore Dad would want us to follow this trail, too. It shore looks
mighty strange. You won’t get lost.”
“You don’t know what you might be getting into,” Virginia said. “I
think you should let that trail alone and mind your own business.”
Tom shook his head, tightening his saddle strap.
“We’re goin’ so you might as well save your breath. See you at Bear
Rock,” he added as he and Jim swung their horses about and were
off in a cloud of dust.
The girls stared after them in surprise, then Virginia, with a shrug of
her shoulders, turned her horse and led the way at an abrupt angle
from the road taken by Jim and Tom. Gale undertook to bring up the
rear with the pack horses. As the girls jogged forward, Phyllis rode
directly behind Virginia with Janet and Carol following. Valerie had
dropped behind with Gale.
“Do you suppose that mysterious trail was left by the bank bandits?”
Valerie murmured in a low tone to her friend.
“I shouldn’t be surprised,” Gale answered. “You know, Val, that is
what they are really looking for. I believe that is why Jim has a
definite camping place in mind for each day and doesn’t let us loiter
much along the way. He and Tom must think the rustlers and
robbers are connected.”
Valerie nodded. “Do you think the bandit might have been the man
you saw at the mine last night?”
Gale frowned. “I don’t know. I’ve been thinking about that. It might
have been, but I can’t be sure because I didn’t get a close enough
look at him. He might have been using the cabin as a hiding place.”
“That’s why he tried to scare us away,” added Valerie. “I believe
that’s it!”
“What are you two chattering about?” Janet wanted to know.
“About having broiled rattlesnake for supper,” Valerie retorted. “I’ve
heard it is very good with mustard.”
It was but a short ride to Bear Rock, so named because a huge
boulder so resembled the head of a ferocious grizzly. Once there, the
girls dismounted and gathered wood for a fire. They would eat a
cold luncheon, but insisted on at least having hot coffee to drink.
The horses were tethered and the girls gathered about the fire.
Seated on stones, for the ground was still damp from the heavy
rains of the day before, the girls waited for the two men to join
them. They drank their coffee and had long finished their lunch
before the clatter of hoofs reached them and Jim and Tom rode up.
“We’ll have a new campsite tonight,” Tom said at once. “Jim and I
want to do a little more sleuthing so we might as well go along and
camp when it gets dark, no matter where we are.”
“That’s better than leaving us behind at any rate,” Carol declared.
“I’m rather anxious to get a look at this trail.”
“Just a lot of hoof marks,” Tom answered blandly.
That was all it proved to be and the girls were disappointed. They
didn’t know what they had expected to find, but certainly more than
this. Unexperienced in trail reading they didn’t realize what a wide,
easy-to-read trail had been left. If they had, they might have been
suspicious. Even so, Tom and Jim, western bred and experienced in
trailing both men and animals, should have been suspicious. But
they weren’t.
In the northern region of Arizona are plateaus broken by high
mountains. Between the foothills of a high range was a winding trail
and it was this that the Adventure Girls and their friends followed,
winding in and out through forests thick with pine trees and
cottonwoods, jack rabbits darting across the trail, making the horses
prance and rear, and the girls getting so weary they could hardly
stay in their saddles.
At last Jim called a halt beside a small stream. The sun was sinking
swiftly. Darkness was creeping into the east. When they had pitched
their tents and supper was started, the girls took time out to admire
the scenery of their surroundings. They were camped on the base of
a rugged plateau broken in two by a narrow pass through which
they proposed to ride on the morrow. Overhanging the pass was a
huge boulder, balanced precariously on the edge of the jutting cliff.
“Just one push is all that needs to block up that whole pass,” Tom
declared.
“Let’s hope nobody pushes it tomorrow when we are going through
there,” commented Janet cheerfully.
“Let’s see what is on the other side of the mountain,” proposed Gale
to Valerie.
“All right,” she agreed readily, getting up from her knees where she
had been putting another piece of wood on the fire.
“Or are you too tired?” Gale asked suddenly, remembering that Val
couldn’t keep going as incessantly as the rest of them.
“Of course I’m not too tired for that short walk,” Val said stoutly.
“Come along.”
“When supper is ready give us a halloo,” directed Gale as the two
started out.
“You’re taking awful chances,” Carol declared mischievously, “we
might eat all the supper without you.”
“You had better not!” Gale warned laughingly.
The two walked leisurely, enjoying the glorious hues of the sunset.
In the west the sky was a maze of colors as the last rays of the sun
flashed on the banked clouds. The gurgling of the little stream by
which they walked was the only sound other than that of their
footsteps that they heard. Yet Gale had the uncanny feeling that
eyes were watching them. Once she turned to look back at the
others in camp. They were all busy with something or other. No one
was watching her and Val. Yet that peculiar feeling persisted.
Directly beneath the overhanging boulder they paused to look up at
it. It hung menacingly over them. They took a few steps forward
when something made Gale look up again. Certainly her eyes had
not played a trick on her! The rock had actually wavered. It was
falling!
“Run, Val, run,” she shouted, at the same time grasping her friend’s
arm and pulling her along.
“What in the world----” Valerie began.
“The rock--it’s falling!” Gale panted.
Thereafter she did not need to urge Val to exert speed to get away
from the spot toward which the rock was rushing. The two of them
flung themselves forward while certain destruction hurtled down
almost on them. The boulder crashed into the earth with such force
that it half buried itself. On top of it poured earth that had been
loosened in its descent.
“What if we had been under it?” gasped Val when the girls, at a safe
distance, viewed the wreckage behind them.
“We would look like pancakes now,” Gale said humorously. “With
that landslide, can you tell me how we are going to get out of here
for our supper?”
Valerie looked around. What they had thought was a trail leading
through the mountains was just a trail that led to the basin here, a
valley on all sides of which rose steep hills. Their only means of
entrance and exit had been through the pass, and now that was
effectively stopped.
“I wish we would have waited for supper,” Gale said, attempting to
keep lighthearted.
“You can join us,” said a suave voice behind the girls.
They whirled and were grasped in rough hands.
“Well, two are better ’n none, eh, boss?” a rumbling voice laughed.
“Maybe we couldn’t get ’em all, but these two will do us.”
Both Gale and Valerie struggled, but what was the use? They were
soon subdued, not too gently, and led away, their hands tied behind
their backs, to a cabin, hidden entirely from the trail in a clump of
trees.
Chapter VIII
PRISONERS
ON THE TRAIL
“Did you kill him, I hope?” Janet asked with keen excitement.
Valerie was in her tent asleep while Gale, after a substantial supper,
told the others of what had happened to them. She had come to the
part in their escape when she stopped and fired at the bandit when
Janet voiced her opinion.
Gale shivered. “I hope I didn’t,” she declared. “I wouldn’t care to be
a murderess.”
“I think there is not much danger of that,” Tom reassured her.
“Those fellows are pretty hard to kill.”
“We were all nearly frantic,” Virginia said, a fond arm about Gale’s
shoulders. “First we saw the rock fall and then when you didn’t come
back--we didn’t know what to think or do!”
“That’s something else,” Gale said, “that rock didn’t fall of its own
accord. It was pushed.”
“Are you sure?” Carol demanded.
“I saw the man,” Gale said positively. “Something, I don’t know
what, made me look up just as we were walking under it.”
“That something saved you from being smashed flatter than a
pancake,” Janet said wisely.
“But who would push the rock?” Madge asked wonderingly. “Those
men didn’t actually want to--murder you, did they?”
Gale laughed nervously. “Let’s hope they didn’t; they might try
again.”
“Hereafter none of you go wandering away by yourselves from
camp,” Jim said sternly. “To-morrow Tom and I will go see those
fellows, since they didn’t come to see us,” he added grimly.
“But you----” Virginia was beginning when her voice died away into
silence.
The thunder of hoofs echoed down into the valley to them. All eyes
turned up to where the rim of the mountain was silhouetted against
the moonlit sky. Three black mounted figures were picking their way
slowly across the trail. In a moment they were swallowed up in the
blackness of a forest as they made their way down to the valley
some distance from the Adventure Girls’ camp.
“Three of them,” Tom murmured. “Evidently you didn’t kill that fellow
after all, Gale.”
“And I’m afraid we won’t be able to get a look at them tomorrow,”
Jim added. “We’ll follow their trail of course to see in what direction
they are heading. I think, Virginia, you had better lead the girls back
to the K Bar O. There is too much danger in these hills.”
“Nothing doing,” Janet interrupted, flatly. “We like danger and we
don’t want to go home. If you follow the bandits, so do we!”
“I’m afraid we’re all agreed on that,” Gale nodded.
“So you see it is useless for you to argue,” Virginia added, as Jim
opened his mouth to protest.
“But Dad wouldn’t like it, Virginia,” Tom said with a frown. “Jim and I
are responsible for you girls. If anything happens----”
“Nothing will,” Carol assured him. “We all bear charmed lives. We
shall return to the K Bar O when our trip is over just as we started
out,” she declared.
“But what about Valerie?” Madge put in. “Do you think she can stand
a lot of hard riding?”
Gale grew thoughtful. “She came through tonight with never a
protest. I believe Val can stand a lot more than we give her credit
for.”
Later, lying on her bed of pine boughs beside Phyllis, Gale thought of
Valerie again. It had been strenuous, climbing down from the roof
and later fleeing through the underbrush and over that huge boulder
had been particularly wearying, without considering that they did it
all on top of a day’s riding. Val had borne up marvelously well. True
she had been near collapse at the end, but then she herself had not
had much vitality left and she had always been stronger than
Valerie. Yes sir, Val was in a much better physical condition than
when they had started for the West.
The morning, however, found Valerie not as robust as Gale’s
optimistic thoughts had pictured her. Breaking camp was delayed
until lunch time in order to give Val the benefit of a few more hours
rest. After luncheon, the party saddled and mounted their horses.
After a while, Jim picked up the trail of the outlaws and they
followed it a short distance. But the bandits had evidently suspected
a chase and rode their horses into a stream. From there all trace of
trail was wiped out.
Sunset found them miles from the scene of the girls’ adventure.
Supper was prepared and after it had disappeared they sat about
the campfire telling stories or singing songs. They retired early and
were up with the first rays of the sun.
Day after day they followed the same procedure. Their skins were
getting tanned and their appetites were enormous.
“I never thought I could eat so much,” wailed Janet, after a
particularly hearty meal.
“You’ll look like a baby elephant when we get back home,”
prophesied Carol encouragingly.
They rode like regular westerners now, and every day they
appreciated more and more the beauty of the country through which
they rode. If Jim had planned on showing them the loveliest scenery,
he was running true to plan. The girls had never realized before that
nature, untamed by man, could be so lovely. They never realized
that just to sit and gaze at a sunset could bring such a thrill. In
every way the country was affecting them. Physically they were
healthier than they had ever been. Their mental outlook was
brighter, more cheerful. Here in limitless space, mid tall mountains,
they felt more drawn to one another. Their friendships grew and
flourished.
One day they camped close to the mighty Colorado River that flows
through the Grand Canyon. The cliffs of sandstone and limestone,
almost a mile high, were so rugged and majestic as to fill the girls
with awe. All the colors of the rainbow were in the rocks and under
the influence of the sun and the shadows cast by it, formed pictures
of entrancing beauty, pictures too beautiful to ever be put down on
canvas. Rain and wind had sculptured the cliffs into bewildering and
fantastic forms which added to their brilliant coloring.
“Doesn’t it make you feel tiny?” murmured Janet, scarcely above a
whisper, afraid to disturb the great hush that hung over the Canyon.
“The Canyon was first seen by white men in 1541,” Tom told them.
“The Colorado River where it runs through the Canyon there is three
hundred feet wide, and in times of freshets it’s a mighty torrent.”
“You sound like a traditional guide book,” Janet told him.
“It’s wonderful,” Valerie murmured, voicing the feelings of all of
them.
Another day found the Adventure Girls and their friends examining
the colossal stone tree trunks of the Petrified Forest. Here they
found more to awe and surprise them. Still another day found them
at the rim of the Painted Desert, the desert with its multi-colored
plains alive with somber, purple shadows.
“I’m overwhelmed!” Carol declared. “From now on I shall be a strong
advocate of See America First!”
Valerie had out the little sketching block she always carried with her.
With a strong talent for sketching and limitless subjects on which to
try her skill, Val rode with her pencil and pad in her hands nearly all
day. She wanted to take back home sketches of the spots that
interested her most on this trip.
“I’ll never be able to make it look as beautiful on paper as it really
is,” she sighed. “No one could really hope to.”
“I’d like to have one of the sketches you made of the Canyon the
other day,” Gale said. “I intend to frame it and keep it as a
memento.”
“Isn’t it funny, Gale,” Val mused aloud, “how you never miss
anything until you’ve seen it.”
“You might feel as though you miss something,” Gale agreed, “but
you don’t know what it is.”
“I shall miss all this a lot when we go back East,” Val declared,
looking about at the Arizona sunset. “Everything is so--big out here.
I feel awf’ly small. When I think of the silly things we quarrel over in
school and the things we think we can’t get along without in the city,
it makes me ashamed of myself.”
Gale laughed. “If you lived out here long enough, I’m afraid you
would have a bad inferiority complex.”
“No, but don’t you feel that way?” Val demanded. “Tomorrow we
start for Monument Valley near Kayenta. That’s one hundred and
seventy-five miles from the nearest telephone. Imagine what that
means! Back home we don’t think anything of a telephone because
nearly everybody has one.”
“Yes, and just think, I haven’t had a chocolate soda since I came out
here,” chimed in Janet, coming up behind them. “I hope I shall
survive.”
“You look as though you might pull through,” Valerie laughed.
“Come and get it!” Tom called and there was a concerted rush for
the makeshift supper table.
Day after day they rode through cañons and winding intermittent
gullies, shallow basins, and dry washes. They followed trails through
thick sagebrush and cottonwoods, over dry beds of streams and
sunken deserts, marveling how the dull gray and olive of the
sagebrush and trees mingled. They learned that many of the
mountains were extinct volcanoes and admired the brilliant colored
sandstone and shale formations. Once or twice they ran into heavy
thunderstorms that turned dried-up streams into rushing torrents of
muddy swirling waters.
They explored with keen interest Monument Valley with the spire-like
rock of El Capitan at its head, and its fantastic flat topped pillars
rising thousands of feet into the air. A day’s ride from Kayenta the
riders came upon Betatakin, one of the most interesting, although
least known, of the cliff dwellings, standing silent within its
mammoth cave.
“Just think, hundreds of people lived and died here a thousand years
ago,” Virginia commented.
“I’m glad we don’t live in houses like these,” Janet said, as she
climbed up the worn stone steps to the next level. “I’ve no desire to
climb all these steps every time I want to go home.”
“If you walked in your sleep it was just too bad,” added Carol,
looking back down at the stones over which they had come.
“It gives me an appetite,” Madge complained. “When do we eat?”
“The sooner the better,” put in Phyllis.
For hours the girls prowled around in the dark houses of the cliff
dwellers, taking their time to examine everything of interest. The
next day they resumed their riding, heading south toward the K Bar
O.
During the days Gale and Phyllis had a lot of practice with their
revolvers and now could succeed in coming fairly close to the bull’s
eye every time they tried. Gale, too, was becoming proficient with
her rope. Jim spent hours teaching her and she proved an apt pupil.
Riding with Virginia behind Jim as they swung along the trail, Gale
was looking up at the trees and the blue sky, thinking how she
would hate to leave all this when it came time for the Adventure
Girls to go back East.
“Look out, Jim!” Virginia screamed suddenly.
There was a snarl and a streak of yellow leaped from the low-
hanging limb of a tree. Jim’s horse reared wildly and plunged away
as its rider was dragged from the saddle by the impact of the
cougar’s weight.
For a second none of the riders could do anything but check their
mounts. All the horses threatened to run away and careened wildly,
almost unseating their riders. Meanwhile, Jim was thrashing about
on the ground, struggling for his life while his companions watched
helplessly.
“Quiet, boy,” Gale said, a soothing hand on her trembling pony’s
neck. With her other hand she unfastened her rope.
“Look out, I’m going to shoot,” Tom said, raising his rifle to his
shoulder.
“Don’t!” Carol cried. “You might hit Jim.”
“But the beast is killing him,” Janet said with a shudder. “Somebody
do something!”
Despite Carol’s warning, Tom discharged his gun and succeeded only
in frightening the ponies more. Jim was fighting madly to keep the
sharp claws and teeth away from his face and throat.
Once more Gale spoke to her pony and patted him reassuringly. He
jerked nervously under her hand, but he was by far the quietest one
of the beasts. During the days in the saddle Gale had learned the
tricks and tendencies of her mount and she had instilled a trust in
him for his rider. Now, though he longed to flee from this spot with
its danger, he stood quietly obedient to her voice and touch. In her
hand Gale held her coiled rope. Tom had dismounted and handed
the reins of his horse and of the pack horses to Carol and was
edging nearer to those thrashing figures on the ground. Virginia,
too, had dismounted.
At the first opportune moment, Gale’s rope slithered out and fell over
the two. The loop caught a hind leg of the cougar. Immediately it
tightened and the snapping teeth were diverted from Jim to the rope
about its leg.
“Go it, boy!” Gale urged her horse.
The horse darted forward. Behind her the rope pulled the cougar
clear from Jim. The pony sped down the trail, its rider bent low in
the saddle, the rope dragging the squirming, struggling mountain
lion over the stony ground. Gale did not slow her mount till she was
sure that the animal was dead. Then she turned her horse and
trotted him slowly back to the group.
Tom and Virginia were busy with Jim. The cowboy’s shirt hung in
ribbons, and the flesh of his shoulders and arms was streaming with
blood. He had a long scratch along his cheek, but otherwise he was
safe and sound.
“Never thought that rope trainin’ would come in so handy,” he
grinned at her. “Reckon I owe you a heap for pullin’ that fella offa
me, Miss Gale.”
“Is he dead?” Janet asked tremulously with a glance for the dust
covered thing at the end of Gale’s rope.
“If he isn’t, he ought to be,” Gale replied, dismounting. “Are you hurt
much, Jim?”
The cowboy insisted that they should not stop their day’s ride on his
account. After Tom’s first aid treatment had been administered and
Jim remounted his horse, they started forward again. Tom had cut
the cougar loose from Gale’s rope and pulled him to one side of the
trail.
“That’s what I like about the country out here,” Janet said to no one
in particular. “Always something doing. Any time at all you might
step on a rattlesnake or get jumped on by a ferocious animal. Nice
country!” she declared with a grin.
“Pleasant thoughts you have,” Carol laughed. “It’s no worse than
back home. There we have to dodge street cars and taxi cabs.”
“Give me the taxi cabs,” Madge murmured. “They at least give you a
warning.”
It was late when they stopped for their camp. Riding and excitement
had whetted their appetites and while they ate, Tom and Jim told
them of other experiences each had had with animals in the
surrounding country. Jim took the whole affair as all part of the day,
and refused to declare himself a bit thrilled over it.
“At least we’ll have something to talk about when we get home,”
Phyllis smiled.
“We’ve got a lot to talk about,” Valerie declared. “We’ve met nearly
everything the West can produce, haven’t we?”
“Nearly,” Virginia laughed. “Do you feel like going home now?”
“No!” came unanimously from all the girls.
“Well, whether you like it or not, we are,” Tom declared. “Tomorrow
we get back on K Bar O soil. Two more days and we’ll be at the
ranch house.”
“We’ve got to go home, our supplies are running low,” Virginia
explained.
“Can we go on another trip then?” Carol asked immediately.
“If we have enough time,” Valerie commented. “The days have gone
so quickly. We’ll be going home soon.”
“We’ll refuse to think of that,” Phyllis said firmly. “Let’s hear some
more of your experiences,” she suggested to Jim and Tom.
For another hour while the fire crackled and shadows danced over
the tents and figures around it, Jim entertained them with memories
of the range lands. Valerie and Phyllis retired first. After them went
the other four girls. Gale alone remained beside the fire with her
cousin and the cowboy.
“Tom----” Gale began hesitantly.
“Yes?” Tom encouraged, tossing another log on the fire.
“That trail we passed just before we camped--was it the bandits’?”
she asked.
Tom and Jim exchanged a fleeting glance.
“What made you think of them?” Tom asked.
“Before we started on this trip,” Gale said, “Valerie and I overheard
you and your dad talking about rustlers. We didn’t mean to listen,
but we did. Had that trail today anything to do with them? I thought
you both looked worried when you saw it.”
“We were worried,” Jim admitted. “It was a fresh trail and the same
men who held you prisoner that night in the hills, made that trail.
We thought we had lost them sure, but it doesn’t look that way.”
“What are you going to do?” Gale wanted to know.
“Nothing,” Tom said promptly. “We are going to take you girls safely
back to the K Bar O.”
“The bandits are probably making for the border into Mexico,” Jim
murmured. “The Sheriff and his men will catch ’em.”
Tom laughed. “They haven’t done much catching so far. I’ll bet the
bandits get clean away.”
“Then there is nothing to worry about,” Gale said.
“No, nothing to worry about,” agreed Tom.
When Gale had entered the tent she shared with Valerie and Phyllis,
she went immediately to sleep and did not know that long after she
retired, Tom and Jim talked seriously and long about the possibility
of meeting the rustlers before they reached the ranch safely.
Chapter X
RUSTLERS
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com