SlideShare a Scribd company logo
SQL Server Internals In Memory OLTP Inside the
SQL Server 2016 Hekaton Engine 2nd Edition Kalen
Delaney download
https://textbookfull.com/product/sql-server-internals-in-memory-
oltp-inside-the-sql-server-2016-hekaton-engine-2nd-edition-kalen-
delaney/
Download more ebook from https://textbookfull.com
We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!
Expert SQL Server In-Memory OLTP 2nd Edition Dmitri
Korotkevitch
https://textbookfull.com/product/expert-sql-server-in-memory-
oltp-2nd-edition-dmitri-korotkevitch/
Pro SQL Server Internals 2nd Edition Dmitri
Korotkevitch
https://textbookfull.com/product/pro-sql-server-internals-2nd-
edition-dmitri-korotkevitch/
Expert SQL Server Transactions and Locking: Concurrency
Internals for SQL Server Practitioners 1st Edition
Dmitri Korotkevitch
https://textbookfull.com/product/expert-sql-server-transactions-
and-locking-concurrency-internals-for-sql-server-
practitioners-1st-edition-dmitri-korotkevitch/
SQL Server Execution Plans For SQL Server 2008 through
to 2017 and Azure SQL Database 3rd Edition Grant
Fritchey
https://textbookfull.com/product/sql-server-execution-plans-for-
sql-server-2008-through-to-2017-and-azure-sql-database-3rd-
edition-grant-fritchey/
SQL Server 2016 Developer s Guide 1st Edition Dejan
Sarka
https://textbookfull.com/product/sql-server-2016-developer-s-
guide-1st-edition-dejan-sarka/
Microsoft SQL Server 2016 a beginner's guide Sixth
Edition Petkovic
https://textbookfull.com/product/microsoft-sql-
server-2016-a-beginners-guide-sixth-edition-petkovic/
Building Custom Tasks for SQL Server Integration
Services: The Power of .NET for ETL for SQL Server 2019
and Beyond 2nd Edition Andy Leonard
https://textbookfull.com/product/building-custom-tasks-for-sql-
server-integration-services-the-power-of-net-for-etl-for-sql-
server-2019-and-beyond-2nd-edition-andy-leonard/
Securing SQL Server: DBAs Defending the Database 2nd
Edition Peter A. Carter
https://textbookfull.com/product/securing-sql-server-dbas-
defending-the-database-2nd-edition-peter-a-carter/
Azure SQL Revealed: A Guide to the Cloud for SQL Server
Professionals Bob Ward
https://textbookfull.com/product/azure-sql-revealed-a-guide-to-
the-cloud-for-sql-server-professionals-bob-ward/
Inside the SQL Server 2016 Hekaton Engine
SQL Server Internals:
In-Memory OLTP
By Kalen Delaney
Second Edition
SQL Server Internals:
In-Memory OLTP
Inside the SQL Server 2016 Hekaton Engine
By Kalen Delaney
Foreword by Rimma Nehme, Microsoft
Technical Review by Benjamin Nevarez
Technical Edit by Tony Davis
First published by Simple Talk Publishing 2017
Copyright © Kalen Delaney 2017
ISBN 978-1-910035-19-1
The right of Kalen Delaney to be identified as the author of this work has been asserted by her in accordance with
the Copyright, Designs and Patents Act 1988.
All rights reserved. No part of this publication may be reproduced, stored or introduced into a retrieval system, or
transmitted, in any form, or by any means (electronic, mechanical, photocopying, recording or otherwise) without
the prior written consent of the publisher. Any person who does any unauthorized act in relation to this publica-
tion may be liable to criminal prosecution and civil claims for damages.
This book is sold subject to the condition that it shall not, by way of trade or otherwise, be lent, re-sold, hired out,
or otherwise circulated without the publisher's prior consent in any form other than which it is published and
without a similar condition including this condition being imposed on the subsequent publisher.
Cover Image: Andy Martin.
Typeset by Gower Associates.
Contents
Introduction 16
1: What's Special About In-Memory OLTP? 20
Isn't In-Memory OLTP Just an Improved DBCC PINTABLE? 20
The In-Memory OLTP Component 21
Memory-optimized tables 22
Entirely in-memory storage 22
Row-based storage structure 23
Native compilation of tables 24
Natively compiled stored procedures 24
Concurrency improvements: the MVCC model 25
Indexes on memory-optimized tables 26
Data durability and recovery 27
Performance 29
What's New for In-Memory OLTP in SQL Server 2016 30
SQL Server In-Memory OLTP in Context 31
Summary 33
Additional Resources 34
Chapter 2: Creating and Accessing In-Memory OLTP Databases and Tables 35
Creating Databases 35
Azure SQL Database 37
Creating Tables 38
Durability 39
Indexes and constraints 39
Data type restrictions 41
Creating Table Types and Table Variables 42
Altering Memory-Optimized Tables 43
Accessing Memory-Optimized Tables with T-SQL 46
Interpreted T-SQL 46
T-SQL in natively compiled procedures 47
Memory Allocation for Memory-Optimized Tables and Indexes 48
Summary 52
Additional Resources 53
Chapter 3: Row Structure and Multi-Versioning 54
Row Structure 54
Row header 55
Payload area 56
Row Versions, Timestamps and the MVCC Model 56
Transaction IDs and timestamps 56
Row versions and transaction processing phases 58
Processing phase 59
Validation phase 62
Post-processing 62
Summary 64
Additional Resources 64
Chapter 4: Indexes on Memory-Optimized Tables 65
Nonclustered and Hash and Range Indexes 65
Hash indexes 67
Row organization 68
Choosing hash indexes 71
Determining the number of hash buckets 72
Range indexes 73
The Bw-tree 74
Index page structures 77
Internal index maintenance operations 78
Columnstore Indexes 86
Columnstore index basic architecture 86
Clustered columnstore indexes on memory-optimized tables 88
Updating columnstore indexes 88
Examining index metadata for a columnstore index on a
memory-optimized table 91
Examining Index Metadata 95
Indexes on Temporal Tables 97
Summary 97
Additional Resources 98
Chapter 5: Transaction Processing 99
Transaction Scope 99
Transaction Isolation Levels 100
Isolation levels with disk-based tables 101
Isolation levels with memory-optimized tables 102
Rules for cross-container transactions (interpreted T-SQL) 103
READ COMMITTED cross-container transactions must specify a
valid isolation level 104
SNAPSHOT cross-container transactions cannot access
memory-optimized tables 106
REPEATABLE READ or SERIALIZABLE cross-container transactions
must use SNAPSHOT 107
Choosing an isolation level for accessing memory-optimized tables 109
Monitoring Active Transactions 110
Transaction Processing Examples 111
Write-write conflicts 112
Read-write conflicts 113
Validation Phase 116
Validation phase, Step 1: Check for isolation level violations 117
SNAPSHOT isolation level violations 117
REPEATABLE READ isolation level violations 119
SERIALIZABLE isolation level violations 119
Validation of foreign keys 120
Validation phase, Step 2: Commit dependencies 120
Validation phase, Step 3: Logging 121
Post-processing 123
Garbage Collection of Rows in Memory 123
Summary 126
Additional Resources 127
Chapter 6: Logging, Checkpoint, and Recovery 128
Transaction Logging 129
Scalability: multiple concurrent log streams 129
Performance: reduced logging 130
Checkpoint 135
Anatomy of checkpoint files 136
Continuous checkpointing and checkpoint events 140
Checkpoint file metadata states 141
The checkpoint event 147
The threads and tasks comprising the full checkpoint process 149
Merging checkpoint files 150
Automatic merge 151
Garbage collection of checkpoint files 154
Recovery 155
Summary 156
Additional Resources 156
Chapter 7: Native Compilation of Tables and Native Modules 157
What Is Native Compilation? 157
Maintenance of DLLs 158
Native Compilation of Tables 159
Native Compilation of Modules 160
Parameter Sniffing 162
Compilation and Query Processing 163
Optimization of Natively Compiled Modules 164
Index access paths 165
Hash indexes 165
Range indexes 166
No Halloween protection 166
No automatic recompile 166
Best Practices with Natively Compiled Procedures 167
Performance Comparisons 168
Comparing performance for multi-row inserts 168
Performance analysis using DMV data 173
Summary 174
Additional Resources 174
Chapter 8: SQL Server Support and Manageability 175
Feature Support 176
Memory Allocation and Management 179
Using Resource Governor for memory management 180
Memory usage report 182
Metadata Enhancements and Additions 183
Catalog view enhancements 183
Dynamic Management Objects 184
Extended events 187
Performance counters 188
Best Practices for Designing Memory-Optimized Tables and Indexes 189
Best Practices for Managing Statistics on Memory-Optimized Tables 191
Migration Considerations 191
Common application bottlenecks that in-memory OLTP can resolve 192
Application requirements compatible with migration to in-memory OLTP 193
High volume of INSERTs 193
High volume of SELECTs 194
CPU-intensive operations 194
Extremely fast business transactions 195
Session state management 195
Unsuitable application requirements 196
Current applications 197
The migration process 198
Workload analysis and baselining 198
Summary 200
Additional Resources 201
Foreword
Rimma V. Nehme, Technical Assistant
Data Group at Microsoft
Bellevue, WA
It is my great pleasure to write a foreword to Kalen's book, SQL Server Internals: In-Memory
OLTP, Inside the SQL Server 2016 Hekaton Engine. Kalen has been working with SQL
Server for over 29 years, and even after three decades of working with the SQL Server
technology, she is still very excited to teach, write, and share her knowledge about SQL
Server. She is one of the best-respected technology writers, and her Twitter handle, @
sqlqueen, says it best. I remember when I first started developing for the SQL Server engine,
many years ago, as an intern at Microsoft, I complemented all of our internal documentation
with her Inside SQL Server book. Who knows, maybe if not for that book, I might have not
excelled at my internship, which eventually led to an incredibly rewarding career working
inside the SQL Server engine. Thank you, Kalen!
This book, SQL Server Internals: In-Memory OLTP is a true gem for modern data devel-
opers and data professionals. It contains an unprecedented level of details about the
in-memory technology of SQL Server. In my many conversations with customers, I often
hear a confusion between the terms "In-Memory" and "Memory-Optimized." Many think
that they are one and the same. If you continue reading this book, you will realize the
distinction. In-Memory OLTP is a game changer for relational databases, and especially for
OLTP systems. Processors are not getting dramatically faster, but the number of cores and
the amount of memory is increasing drastically. Machines with terabytes of memory are
becoming a commodity. Over the last 30 years, memory prices have dropped by a factor of
10 every 5 years. Both core counts and memory sizes are increasing at an accelerated pace.
The majority of OLTP databases fit entirely in 1 TB and even the largest OLTP databases
can keep the active working set in memory. A technology that takes advantage of this ever-
changing hardware landscape is Microsoft's in-memory OLTP.
To understand this better, let us travel back in time a few years to when the sizes of OLTP
databases were much larger than the memory available on the server. For example, your
OLTP database could be 500 GB while your SQL Server has 128 GB of memory. We all
know the familiar strategy to address this, by storing data and indexes in smaller chunks,
xii
or pages. SQL Server supports 8 K pages. These pages are read and written in and out of
memory using sophisticated heuristics implemented as part of the buffer pool in SQL Server.
When running a query, if the page containing the requested row(s) is not found in the buffer
pool, an explicit physical I/O is incurred to bring it into memory. This explicit physical I/O
can significantly reduce query performance. Today, you can get around this issue by buying a
server machine with terabytes of physical memory and keeping your entire 500 GB database
in memory, effectively removing any bottleneck due to I/O. However, the more important
question to be asked is: "Is your database optimized for being in-memory?" This book will
teach you how to do it.
Another aspect to consider is locking and latching, and its impact on performance. When you
query your data, SQL Server loads data pages in-memory and keeps them there until it needs
more memory for something else. But traditional tables are still optimized for disk access,
a slow medium. As such, it has a variety of bottlenecks. A big issue is the contention due to
the different locking mechanisms. Each time a transaction reads data, it acquires a read lock
on that data. When another transaction wants to write on the same data, it must acquire a
write-lock and therefore wait for the first transaction to complete, since you can't write while
data is being read. SQL Server also implements latches and spinlocks at different granularity
levels. All those locking mechanisms take time to manage and, moreover, they again jeop-
ardize the performance. From the ground up, in-memory OLTP is designed for high levels
of concurrency. Any thread can access any row in a table without acquiring latches or locks.
The engine uses latch-free and lock-free data structures to avoid physical interference among
threads and a new optimistic, multi-version concurrency control technique to avoid interfer-
ence among transactions using a state-of-the-art lock- and latch-free implementation.
This book describes all of the key aspects of the in-memory OLTP technology that can help
improve the performance of your transactional workloads, including:
• new data structures and data access methods built around the assumption that the
active working set resides in memory
• lock- and latch-free implementation that provides high scalability
• native compilation of T-SQL for more efficient transaction processing.
Announced several years ago, in-memory OLTP has been implemented in production by
numerous companies. Whether you need to support a high data insert rate for system telem-
etry or smart metering, or get high read performance at scale for social network browsing,
or do compute-heavy data processing for manufacturing or retail supply chains, or achieve
xiii
low latency for online gaming platforms or capital markets, or do session management for
heavily-visited websites, in-memory OLTP can help you. One of the best things about this
technology is that it is not all or nothing. The in-memory OLTP engine is integrated into SQL
Server; it is not a separate DBMS. Even if much of your processing is not OLTP, even if your
total system memory is nowhere near the terabyte range, you can still choose one or more
critical tables to migrate to the new in-memory structures. You can also choose a frequently-
run stored procedure to recreate as a natively compiled procedure. And you can get measur-
able performance improvements as a result!
About the Author
Kalen Delaney has been working with SQL Server since 1987, and provides advanced SQL
Server training to clients worldwide. She has been a SQL Server MVP since 1993 and has
been writing about SQL Server almost as long. Kalen has spoken at dozens of technical
conferences, including almost every PASS conference in the US since the organization's
founding in 1999. Kalen is the author or co-author of many books on SQL Server, including
SQL Server 2012 Internals, from Microsoft Press and SQL Server Internals: In-Memory
OLTP (version 2014), from Red Gate. She is one of the main editors for SQL Server
Central's SQL Server Stairways Series, www.sqlservercentral.com/stairway.
Kalen blogs at www.sqlblog.com and her personal website and schedule can be found at
www.SQLServerInternals.com.
Acknowledgements
First of all, I would like to thank Kevin Liu, formerly with Microsoft, who brought me
onboard with the Hekaton project at the end of 2012, with the goal of providing in-depth
white papers describing this exciting new technology. Under Kevin's guidance, I wrote two
white papers, which were published near the release date at each of the CTPs for SQL Server
2014. As the paper got longer with each release, a new white paper for the final released
product would be as long as a book. So, with Kevin's encouragement, it became the first
edition of this book. For the SQL Server 2016 version of in-memory OLTP, Marko Hotti
brought me onboard to write two white papers, including one for the final version of SQL
Server 2016. This book expands upon that second white paper.
xiv
My main mentors for this second edition, based on the changes in SQL Server 2016, were
Sunil Agarwal and Jos de Bruijn. I know they thought my questions would never stop, but
they kept answering them anyway. I am deeply indebted to both of them.
I would also like to thank my devoted reviewers and question answerers at Microsoft,
without whom this work would have taken much longer: in addition to Sunil and Jos,
Kevin Farlee was always willing and able to answer in-depth questions about storage, and
Denzil Ribeiro and Alex Budovski were always quick to respond and were very thorough
in answering my sometimes seemingly-endless questions. Thank you for all your assistance
and support. And THANK YOU to the entire SQL Server team at Microsoft for giving us this
incredible technology!
About the Technical Reviewer
Benjamin Nevarez is a database professional based in Los Angeles, California who special-
izes in SQL Server query tuning and optimization. He is the author of three books, High
Performance SQL Server, SQL Server 2014 Query Tuning & Optimization and Inside the
SQL Server Query Optimizer, and has also coauthored other books including SQL Server
2012 Internals. Benjamin has also been a speaker at many SQL Server conferences and
events around the world including the PASS Summit, SQL Server Connections and SQLBits.
His blog can be found at http://www.benjaminnevarez.com and he can also be reached on
Twitter at @BenjaminNevarez.
xv
Introduction
The original design of the SQL Server engine, as well as that of most other RDBMS products
of the time, assumed that main memory was very limited, and so data needed to reside on
disk except when it was actually needed for processing. However, over the past thirty years,
the sustained fulfillment of Moore's Law, predicting that computing power will double year
on year, has rendered this assumption largely invalid.
Moore's law has had a dramatic impact on the availability and affordability of both large
amounts of memory and multiple-core processing power. Today one can buy a server with
32 cores and 1 TB of memory for under $30K. Looking further ahead, it's entirely possible
that in a few years we'll be able to build distributed DRAM-based systems with capacities of
1–10 Petabytes at a cost of less than $5/GB. It is also only a question of time before non-
volatile RAM becomes viable as main-memory storage.
At the same time, the near-ubiquity of 64-bit architectures removes the previous 4 GB limit
on "addressable" memory and means that SQL Server has, in theory, near-limitless amounts
of memory at its disposal. This has helped to significantly drive down latency time for read
operations, simply because we can fit so much more data in memory. For example, many, if
not most, of the OLTP databases in production can fit entirely in 1 TB. Even for the largest
financial, online retail and airline reservation systems, with databases between 500 GB and
5 TB in size, the performance-sensitive working dataset, i.e. the "hot" data pages, is signifi-
cantly smaller and could reside entirely in memory.
However, the fact remains that the traditional SQL Server engine is optimized for disk-
based storage, for reading specific 8 KB data pages into memory for processing, and writing
specific 8 KB data pages back out to disk after data modification, having first "hardened" the
changes to disk in the transaction log. Reading and writing 8 KB data pages from and to disk
can generate a lot of random I/O and incurs a higher latency cost.
In fact, given the amount of data we can fit in memory, and the high number of cores avail-
able to process it, the end result has been that most current SQL Server systems are I/O
bound. In other words, the I/O subsystem struggles to "keep up," and many organizations
sink huge sums of money into the hardware that they hope will improve write latency. Even
when the data is in the buffer cache, SQL Server is architected to assume that it is not, which
leads to inefficient CPU usage, with latching and spinlocks.
16
Assuming all, or most, of the data will need to be read from disk also leads to unrealistic cost
estimations for the possible query plans and a potential for not being able to determine which
plans will really perform best.
As a result of these trends, and the limitations of traditional disk-based storage structures,
the SQL Server team at Microsoft began building a database engine optimized for large main
memories and many-core CPUs, driven by the recognition that systems designed for a partic-
ular class of workload can frequently outperform more general purpose systems by a factor of
ten or more. Most specialized systems, including those for Complex Event Processing (CEP),
Data Warehousing and Business Intelligence (DW/BI), and Online Transaction Processing
(OLTP), optimize data structures and algorithms by focusing on in-memory structures.
The team set about building a specialized database engine specifically for in-memory work-
loads, which could be tuned just for those workloads. The original concept was proposed at
the end of 2008, envisioning a relational database engine that was 100 times faster than the
existing SQL Server engine. In fact, the codename for this feature, Hekaton, comes from the
Greek word hekaton (ἑκατόν) meaning 100.
Serious planning and design began in 2010, and product development began in 2011. At that
time, the team did not know whether the current SQL Server product could support this new
concept, and the original vision was that it might be a separate product. Fortunately, it soon
became evident that it would be possible to incorporate the "in-memory" processing engine
into SQL Server itself. The team then established four main goals as the foundation for
further design and planning:
1. Optimized for data that was stored completely in-memory but was also durable on
SQL Server restarts.
2. Fully integrated into the existing SQL Server engine.
3. Very high performance for OLTP operations.
4. Architected for modern CPUs (e.g. use of complex atomic instructions).
SQL Server In-Memory OLTP, formerly known and loved as Hekaton, meets all of these
goals, and in this book, you will learn how it meets them. The focus will be on the features
that allow high performance for OLTP operations. As well as eliminating read latency, since
the data will always be in memory, fundamental changes to the memory-optimized versions
of tables and indexes, as well as changes to the logging mechanism, mean that in-memory
OLTP also offers greatly reduced latency when writing to disk.
17
The first four chapters of the book offer a basic overview of how the technology works
(Chapter 1), how to create in-memory databases and tables (Chapter 2), the basics of row
versioning and the new multi-version concurrency control model (Chapter 3), how memory-
optimized tables and their indexes store data, and how columnstore indexes, available for
memory-optimized tables as of SQL Server 2016, allow you to perform efficient OLTP
operations, as well as run analytic queries, on your in-memory data (Chapter 4).
Chapters in the latter half of the book focus on how the new in-memory engine delivers the
required performance boost, while still ensuring transactional consistency (ACID compli-
ance). In order to deliver on performance, the SQL Server team realized they had to address
some significant performance bottlenecks. Two major bottlenecks were the traditional
locking and latching mechanisms: if the new in-memory OTLP engine retained these mecha-
nisms, with the waiting and possible blocking that they could cause, it could negate much
of the benefit inherent in the vastly increased speed of in-memory processing. Instead, SQL
Server In-Memory OLTP delivers a completely lock- and latch-free system, and true opti-
mistic multi-version concurrency control (Chapter 5).
Other potential bottlenecks were the existing CHECKPOINT and transaction logging
processes. The need to write to durable storage still exists for in-memory tables, but in SQL
Server In-Memory OLTP these processes are adapted to be much more efficient, in order to
prevent them becoming performance limiting, especially given the potential to support vastly
increased workloads (Chapter 6).
The final bottleneck derives from the fact that the SQL Server query processor is essentially
an interpreter; it re-processes statements continually, at runtime. It is not a true compiler. Of
course, this is not a major performance concern, when the cost of physically reading data
pages into memory from disk dwarfs the cost of query interpretation. However, once there
is no cost of reading pages, the difference in efficiency between interpreting queries and
running compiled queries can be enormous. Consequently, the new SQL Server In-Memory
OLTP engine component provides the ability to create natively compiled procedures, i.e.
machine code, for our most commonly executed data processing operations (Chapter 7).
Finally, we turn our attention to tools for managing SQL Server In-Memory OLTP structures,
for monitoring and tuning performance, and considerations for migrating existing OLTP
workloads over to in-memory (Chapter 8).
18
Intended Audience and Prerequisites
This book is for anyone using SQL Server as a programmer or as an administrator who
wants to understand how the new Hekaton engine works behind the scenes. It is specifically
a book about Hekaton internals, focusing on details of memory-optimized tables and
indexes, how the in-memory engine delivers transactional consistency (ACID compliance)
without locking or latching, and the mechanics of its checkpointing, logging and garbage
collection mechanisms.
SQL Server In-Memory OLTP is a new technology and this is not a book specifically on
performance tuning and best practices. However, as you learn about how the Hekaton engine
works internally to process your queries, certain best practices, and opportunities for perfor-
mance tuning will become obvious.
This book does not assume that you're a SQL Server expert, but I do expect that you have
basic technical competency and familiarity with the standard SQL Server engine, and relative
fluency with basic SQL statements.
You should have access to a SQL Server 2016 installation, even if it is the Evaluation edition
available free from Microsoft. In addition, SQL Server Developer Edition, which doesn't
have an expiration date, is also available free of charge. Downloads are available from this
link: http://preview.tinyurl.com/lea3ep8. As of SQL Server 2016, Service Pack 1, in-memory
OLTP is available in all editions of SQL Server.
The Hands-On Exercises
This book will provide the reader with scripts for hands-on exercises, shown as listings,
to create memory-optimized databases, tables and indexes and to explore some aspects of
Hekaton behavior. My examples were all created using SQL Server Management Studio
(SSMS).
You can download these scripts from: http://preview.tinyurl.com/y72g47te.
All examples have been verified on SQL Server 2016 SP1 (13.0.4001.0). All of the examples
use custom-built sample databases, as defined in the text and scripts. The only exception is
Listing 2-2 which shows you how to enable an existing database to use memory-optimized
tables; it uses AdventureWorks2014, but you could easily edit the script to substitute any
existing database.
19
1: What's Special About
In-Memory OLTP?
SQL Server 2016's in-memory OLTP feature provides a suite of technologies for working
with memory-optimized tables, in addition to the disk-based tables which SQL Server has
always provided.
The SQL Server team designed the in-memory OLTP engine to be transparently accessible
through familiar interfaces such as T-SQL and SQL Server Management Studio (SSMS).
Therefore, during most data processing operations, users may be unaware that they are
working with memory-optimized tables rather than disk-based ones.
However, SQL Server works with the data very differently if it is stored in memory-opti-
mized tables. This chapter describes, at a high level, some of the fundamental differences
between data storage structures and data operations, when working with memory-optimized,
rather than standard disk-based tables and indexes.
It will also discuss SQL Server In-Memory OLTP in the context of similar, competing
memory-optimized database solutions, and explain why the former is different.
Isn't In-Memory OLTP Just an Improved DBCC
PINTABLE?
Let's dispel this myth right at the start: SQL Server In-Memory OLTP bears no relation or
similarities at all to DBCC PINTABLE, a feature available in older versions of SQL Server
that would not remove any data pages from a "pinned" table from memory, once those pages
were read from disk.
These pinned tables were no different than any other disk-based tables. They required the
same amount of locking, latching, and logging and they used the same index structures,
which also required locking and logging.
By contrast, as we'll discuss through this and subsequent chapters, the memory-optimized
tables in SQL Server In-Memory OLTP are completely different than SQL Server disk-based
tables. They use different data and index structures, and SQL Server takes no locks or latches
20
on these structures during reading or writing, so it can allow concurrent access without
blocking. Also, logging changes to memory-optimized tables is usually much more efficient
than logging changes to disk-based tables.
The In-Memory OLTP Component
In-memory OLTP is integrated with the SQL Server relational engine, allowing us to access
in-memory data using standard interfaces such as T-SQL and SSMS, transparently. However,
its internal behavior and capabilities are very different than those of the standard relational
engine. In addition, in-memory OLTP allows an entirely new, highly efficient access path,
using natively compiled stored procedures.
Figure 1-1 gives an overview of the SQL Server engine with the in-memory OLTP
components.
Figure 1-1: The SQL Server engine including the in-memory OLTP components.
21
1: What's Special About In-Memory OLTP?
On the left side of Figure 1-1 we have the memory-optimized tables and indexes, added as
part of in-memory OLTP, and on the right we see the disk-based tables, which use the data
structures that SQL Server has always used, and which require writing and reading 8 KB data
pages, as a unit, to and from disk.
In-memory OLTP also supports natively compiled stored procedures, an object type that is
compiled to machine code by a new in-memory OLTP compiler and which has the potential
to offer a further performance boost beyond that available solely from the use of memory-
optimized tables. The standard counterpart is interpreted T-SQL stored procedures, which is
what SQL Server has always used. Natively compiled stored procedures can reference only
memory-optimized tables.
The Query Interop component allows interpreted T-SQL to reference memory-optimized
tables. If a transaction can reference both memory-optimized tables and disk-based tables, we
refer to it as a cross-container transaction.
Notice that the client application uses the same TDS Handler (Tabular Data Stream, the
underlying networking protocol that is used to communicate with SQL Server), regardless
of whether it is accessing memory-optimized tables or disk-based tables, or calling natively
compiled stored procedures or interpreted T-SQL.
Memory-optimized tables
This section takes a broad look at three of the key differences between memory-optimized
tables and their disk-based counterparts; subsequent chapters will fill in the details.
Entirely in-memory storage
When accessing disk-based tables, the data we need will hopefully be resident in memory,
although it may not be. If not, the engine needs to read from disk the required data pages.
This basic assumption that the data pages reside on disk underpins all data operations against
disk-based tables, with user processes acquiring locks to protect data pages in the buffer
cache from the effects of concurrent transactions, and SQL Server acquiring latches on pages
as it reads them from, and writes them to, disk.
The first and perhaps most fundamental difference when using memory-optimized tables is
that the whole table and its indexes are stored in memory all the time. Therefore, when
accessing in-memory data structures, user processes will always find the required data
in-memory. Concurrent data operations require no locking or latching whatsoever, thanks to a
new, truly optimistic concurrency model, which we'll get to shortly.
22
1: What's Special About In-Memory OLTP?
As user processes modify in-memory data, SQL Server still needs to perform some disk I/O
for any table that we wish to be durable, in other words where we wish a table to retain the
in-memory data in the event of a server crash or restart. We'll return to this a little later in this
chapter, in the Data durability and recovery section.
Row-based storage structure
The second big difference between disk-based tables and memory-optimized tables is in their
underlying storage structure. The former is optimized for block-addressable disk storage,
whereas the latter is optimized for byte-addressable memory storage.
For disk-based tables, SQL Server organizes data rows into 8 KB units called data pages, with
space allocated from extents (eight contiguous pages), on disk. The data page is the basic unit
of storage on disk and in memory. When SQL Server reads and writes data from disk, it reads
and writes the relevant data pages. A data page will only contain data from one table or index.
User processes modify rows on various data pages as required, and later, during a CHECK-
POINT process, SQL Server first hardens the log records to disk and then writes all dirty
pages to disk, the latter operation often causing a lot of "random" physical I/O.
For memory-optimized tables, there are no data pages, and no extents; there are just "data
rows," written to memory sequentially, in the order the transactions occurred, with each row
containing an index "pointer" to the next row. All "I/O" is then in-memory scanning of these
structures. It means there is no notion of data rows being written to a particular location that
"belongs" to a specified object. However, this is not to imply that memory-optimized tables
are stored as unorganized sets of data rows, like a disk-based heap. In fact, every CREATE
TABLE statement for a memory-optimized table must also create at least one index that
SQL Server can use to link together all the data rows for that table (see the later section on
Indexes on memory-optimized tables).
Each data row consists of two areas, the row header and then the payload, which is the
actual column data. We'll discuss this structure in much more detail in Chapter 3, but the
information stored in the row header includes the identity of the statement that created the
row, pointers for each index on the target table and, critically, some timestamp values. There
will be a timestamp recording the time a transaction inserted a row, and another indicating
the time a transaction deleted a row. SQL Server records updates by inserting a new version
of the row and marking the old version as "deleted." The actual cleanup of row versions that
are no longer required, which involves unlinking them from index structures and removing
them from memory, is a cooperative process involving both user threads and a dedicated
garbage collection thread (more on this in Chapter 5).
23
1: What's Special About In-Memory OLTP?
As this implies, many versions of the same row can coexist at any given time. This allows
concurrent access of the same row, during data modifications, with SQL Server displaying the
row version relevant to each transaction according to the time the transaction started relative
to the timestamps of the row version. This is the essence of the new multi-version concur-
rency control (MVCC) mechanism for in-memory tables, which I'll describe in a little more
detail later in the chapter.
Native compilation of tables
The final significant difference between disk-based and memory-optimized tables is that
the latter are natively compiled. When we create a memory-optimized table or index, SQL
Server describes the structure of the table and its indexes in the metadata for the table. It then
uses this metadata to compile into a DLL (Dynamic Link Library) a set of native language
routines (from an intermediate, auto-generated C language step) just for accessing that table.
These DLLs are associated with the database, but not actually part of it.
In other words, SQL Server holds in memory, not only the table and index structures, but also
a set of DLLs for accessing and modifying these data structures. The table metadata encodes
into each DLL a set of native language algorithms that describe precisely the row format
for the table and how to traverse its indexes, thus providing highly efficient access paths
for the table data. This explains why we cannot technically alter a table, once created; if the
table were altered, SQL Server would have to regenerate all the DLLs for table operations.
Although SQL Server 2016 does allow the use of the ALTER TABLE command for memory-
optimized tables, behind the scenes SQL Server is actually dropping and recreating the table,
and thus all the DLLs for table operations are regenerated.
These DLLs result in much faster data access than is possible via the traditional way of using
interpreted metadata. A big success of the implementation of in-memory OLTP is to have
made these operations "invisible" to the user.
Natively compiled stored procedures
The best execution performance is obtained when using natively compiled stored procedures
to access memory-optimized tables, which are also natively compiled, as described above.
Natively compiled stored procedures consist of processor instructions that can be executed
directly by the CPU, without the need for further compilation or interpretation. Also, a
natively compiled procedure will generate far fewer CPU instructions for the engine to
execute than the equivalent interpreted T-SQL stored procedure.
24
1: What's Special About In-Memory OLTP?
However, there are limitations on the T-SQL language constructs that are allowed inside a
natively compiled stored procedure, compared to the rich feature set available with inter-
preted code. In addition, natively compiled stored procedures can only access memory-opti-
mized tables and cannot reference disk-based tables. Chapter 7 discusses natively compiled
stored modules in detail.
Concurrency improvements: the MVCC model
SQL Server's traditional pessimistic concurrency control mechanisms, when accessing disk-
based tables, use locks and latches to prevent "interference" between concurrent transac-
tions on the same data rows, and so preserve the ACID characteristics of each transaction.
Processes that read data take shared locks on a resource to prevent processes writing data
from modifying that data until the reading statement (or transaction, depending on the trans-
action isolation level) commits or rolls back. Writers take exclusive locks to prevent other
readers and writers from accessing "in-transit" data. In other words, transactions often have
to pause processing while they wait to acquire locks (or latches) on a resource.
SQL Server 2005 introduced a "sort of" optimistic version of concurrency control, using the
snapshot-based isolation levels, and maintaining previous row versions in a tempdb version
store. Under this model, readers no longer acquire shared locks. Instead of blocking, when
one transaction needs to read rows that another transaction is modifying, the reader retrieves,
from the version store, the previously committed values of the set of rows it needs. There-
fore, SQL Server can preserve the ACID properties without having readers block writers,
and without writers blocking readers. However, SQL Server still acquires locks during data
modifications and so writers still block other writers.
In contrast, SQL Server In-Memory OLTP introduces a truly optimistic MVCC model. It uses
row versioning but its implementation bears little relation to the snapshot-based model used
for disk-based tables. When accessing memory-optimized tables and index structures, SQL
Server still supports the ACID properties of transactions, but it does so without ever using
locking or latching to provide transaction isolation. The tempdb database is not used for
any storage. This means that no transaction ever has, for lock-related reasons, to wait to read
or modify a data row. Readers never block writers, writers never block readers, and writers
never block writers. Chapter 5 provides further details on concurrency management with
memory-optimized tables.
25
1: What's Special About In-Memory OLTP?
Indexes on memory-optimized tables
Indexes perform the same purpose for memory-optimized tables as their disk-based counter-
parts. However, again, under the covers they are very different structures.
With disk-based storage structures, there are data pages that combine sets of rows into a
single structure. With in-memory structures, there are no such pages and instead SQL Server
uses indexes to combine all the rows that belong to a table into a single structure. Every
memory-optimized table must have at least one index.
In general, we create indexes as part of table creation; unlike for disk-based indexes, we
cannot use CREATE INDEX to create memory-optimized indexes. As of SQL Server 2016,
we can use ALTER TABLE to add a new index to a memory-optimized table. If we create a
PRIMARY KEY on a column, and durable memory-optimized tables must have a PRIMARY
KEY, then SQL Server automatically creates a unique index on that column.
Like tables, SQL Server memory-optimized indexes are always entirely memory resident.
However, unlike for tables, SQL Server never logs operations on indexes. Except for column-
store indexes, which as of SQL Server 2016 can be created on memory-optimized tables,
SQL Server never persists indexes on memory-optimized tables to the on-disk checkpoint
files (covered shortly). SQL Server maintains indexes automatically during all modification
operations on memory-optimized tables, just like B-tree indexes on disk-based tables, but in
case of a restart, SQL Server rebuilds the indexes on the memory-optimized tables as the data
is streamed into memory. Again, the exception is columnstore indexes on memory-optimized
tables, which don't have to be completely rebuilt on SQL Server restart.
In addition to the afore-mentioned columnstore indexes, memory-optimized tables support
two basic types of indexes, both of which are nonclustered structures: hash indexes and
range indexes.
A hash index is a special type of SQL Server index, specifically for memory-optimized
tables, which is useful for performing lookups on specific values. A hash index is stored as a
hash table, and is essentially an array of hash buckets, where each bucket points to the loca-
tion in memory of a data row. SQL Server applies a hash function to the index key values,
and maps each one to the appropriate bucket. In each bucket is a pointer to a single row, the
first row in the list of rows that hash to the same value. From that row, all other rows in the
hash bucket are joined in a singularly-linked list (this will become clearer when we get to see
some diagrams in Chapter 4).
26
1: What's Special About In-Memory OLTP?
A nonclustered range index, useful for retrieving ranges of values, is more like the sort of
index we're familiar with when working with disk-based tables. However, again, the structure
is different. The memory-optimized counterparts use a special Bw-tree storage structure.
A Bw-tree is similar to a disk-based B-tree index in that it has index pages organized into
a root page, a leaf level, and possibly intermediate-level pages. However, the pages of a
Bw-tree are very different structures from their disk-based counterparts. The pages can be
of varying sizes, and the pages themselves are never modified; new pages are created when
necessary, when the underlying rows are modified.
Columnstore indexes, which were added to the product in SQL Server 2012, are available
with memory-optimized tables starting in SQL Server 2016. These indexes allow you to
perform analytics, efficiently, on the data that is stored in memory. As the name "in-memory
OLTP" implies, memory-optimized tables are optimized for transaction processing, but by
adding columnstore indexes, we can also get good performance with analytical operations,
such as reports which need to process and summarize all the rows in the table. Columnstore
indexes are described in detail in Chapter 4.
Data durability and recovery
For memory-optimized data structures, both tables and indexes, all the data is stored in
memory, all the time. However, to continue to ensure the durability of the data, SQL Server
logs operations on memory-optimized tables (not indexes) to the same transaction log that
is used to log operations on disk-based tables and, as always, the transaction log is stored
on disk.
Efficient logging for in-memory data
We'll discuss this topic in much more detail in Chapter 6, but logging for in-memory tables
is more efficient than for disk-based tables essentially because, given the same workload, SQL
Server will write far fewer log records for an in-memory table than for its equivalent disk-
based table. For example, it doesn't log any changes to data in indexes. It will also never write
log records associated with uncommitted transactions, since SQL Server will never write dirty
data to disk for in-memory tables. Also, rather than write every atomic change as a single log
record, in-memory OLTP will combine many changes into a single log record.
SQL Server In-Memory OLTP also continuously persists the table data to disk in special
checkpoint files. It uses these files only for database recovery, and only ever writes to them
"offline," using a background thread. Therefore, when we create a database that will use
27
1: What's Special About In-Memory OLTP?
memory-optimized data structures, we must create, not only the data file (used only for disk-
based table storage) and the log file, but also a special MEMORY_OPTIMIZED_DATA file-
group that will contain the checkpoint files. There are four types of checkpoint files: DATA
files and DELTA files exist as pairs, and so are frequently referred to as checkpoint file pairs.
In SQL Server 2016, we also have ROOT files and LARGE DATA files. We'll see more on
these checkpoint files in Chapter 6.
These checkpoint files are append-only and SQL Server writes to them strictly sequentially,
in the order of the transactions in the transaction log, to minimize the I/O cost. In case of a
system crash or server shutdown, SQL Server can recreate the rows of data in the memory-
optimized tables from the checkpoint files and the transaction log.
When we insert a data row into a memory-optimized table, the background thread (called the
offline checkpoint thread) will, at some point, append the inserted row to the corresponding
DATA checkpoint file. Likewise, when we delete a row, the thread will append a reference to
the deleted row to the corresponding DELTA checkpoint file. So, a "deleted" row remains in
the DATA file but the corresponding DELTA file records the fact that it was deleted. As the
checkpoint files grow, SQL Server will at some point merge them, so that rows marked as
deleted actually get deleted from the DATA checkpoint file, and create a new file pair. Again,
further details of how all this works, as well as details about the other types of checkpoint
files, can be found in Chapter 6.
In-memory OLTP does provide the option to create a table that is non-durable, using an
option called SCHEMA_ONLY. As the option indicates, SQL Server will log the table
creation, so the table schema will be durable, but will not log any data manipulation language
(DML) on the table, so the data will not be durable. These tables do not require any I/O
operations during transaction processing, but the data is only available in memory while SQL
Server is running. These non-durable tables could be useful in certain cases, for example as
staging tables in ETL scenarios or for storing web server session state.
In the event of a SQL Server shutdown, or an AlwaysOn Availability Group fail-over,
the data in these non-durable tables is lost. When SQL Server runs recovery on the database,
it will recreate the tables but without the data. Although the data is not durable, operations
on these tables meet all the other transactional requirements; they are atomic, isolated,
and consistent.
We'll see how to create both durable and non-durable tables in Chapter 2.
28
1: What's Special About In-Memory OLTP?
Performance
The special data structures for rows and indexes, the elimination of locks and latches, and the
ability to create natively compiled stored procedures and functions, all allow for incredible
performance when working with memory-optimized tables. In the Microsoft lab, one partic-
ular customer achieved 1 million batch requests/sec, with 4 KB of data read and written with
each batch, without maxing out the CPU.
Although that workload used SCHEMA_ONLY tables, durable (SCHEMA_AND_DATA) tables
can also get impressive results. Lab results repeatedly showed a sustained ingestion of 10M
rows/second, with an average of 100 bytes per row. A representative order processing work-
load showed 260 K transactions per second, with 1 GB/sec of log generation.
Both the SCHEMA_ONLY and SCHEMA_AND_DATA tables were created on 4-socket servers
with a total of 72 physical cores.
SQL Server 2014 was consistently showing in-memory OLTP applications achieving a
30–40x improvement, measured mainly with batch requests processed per second. In SQL
Server 2016, the visionary improvement of a 100-fold increase has been achieved by one
of the earliest adopters of SQL Server In-Memory OLTP. A process running on SQL Server
2012 had measured overall throughput of 12,000 batch requests per second, with the main
bottleneck being latch contention. The same process running on SQL Server 2016, taking
advantage of memory-optimized tables with large object (LOB) support, and natively
compiled procedures, showed 1.2 million batch requests per second. The bottleneck in that
case was CPU.
The designers of the in-memory OLTP technology in SQL Server were so sure of the
performance gains that would be realized, that the component name "xtp," which stands for
"eXtreme Transaction Processing," is used in most of the Hekaton metadata object names.
29
1: What's Special About In-Memory OLTP?
Discovering Diverse Content Through
Random Scribd Documents
soon after," is a not infrequent phrase. It is manifestly impossible to
investigate these cases now, and to verify the facts, but the well-
tested honesty of the early Friends leaves little ground for doubting
that the facts were substantially as they are reported. Fox's own
inference that all these persons had misfortune as a direct
"judgment" for having harmed him and hindered his cause will
naturally seem to us a too hasty conclusion. It is not at all strange
that in this eventful period many persons who had dealings with him
should have suffered swift changes of fortune, and of course he
failed to note how many there were who did not receive judgment in
this direct manner. One regrets, of course, that this kindly spiritual
man should have come so near enjoying what seemed to him a
divine vengeance upon his enemies, but we must remember that he
believed in his soul that his work was God's work, and hence to
frustrate it was serious business.
He founded a Society, as he called it, which he evidently hoped, and
probably believed, would sometime become universal.[E]
The
organization in every aspect recognized the fundamentally spiritual
nature of man. Every individual was to be a vital, organic part of the
whole; free, but possessed of a freedom which had always to be
exercised with a view to the interests and edification of the whole. It
was modelled exactly on the conception of Paul's universal Church of
many members, made a unity not from without, but by the living
presence of the One Spirit. All this work of organization was effected
while Fox himself was in the saddle, carrying his message to town
after town, interrupted by long absences in jail and dungeon, and
steadily opposed by the fanatical antinomian elements which had
flocked to his standard. It is not the least mark of his genius that in
the face of an almost unparalleled persecution he left his fifty
thousand followers in Great Britain and Ireland formed into a
working and growing body, with equally well-organized meetings in
Holland, New England, New York, Pennsylvania, Maryland, Virginia
and the Carolinas. His personality and his message had won men
from every station of life, and if the rank and file were from the
humbler walks, there were also men and women of scholarship and
fame. Robert Barclay, from the schools of Paris, gave the new faith
its permanent expression in his Apology. William Penn worked its
principles out in a holy experiment in a Christian Commonwealth,
and Isaac Penington, in his brief essays, set forth in rich and varied
phrase the mystical truth which was at the heart of the doctrine.
This is the place for exposition, not for criticism. It requires no
searchlight to reveal in this man the limitations and imperfections
which his age and his own personal peculiarities fixed upon him. He
saw in part and he prophesied in part. But, like his great
contemporary, Cromwell, he had a brave sincerity, a soul absolutely
loyal to the highest he saw. The testimony of the Scarborough jailer
is as true as it is unstudied—"as stiff as a tree and as pure as a bell."
It is fitting that this study of him should close with the words of the
man who knew him best—William Penn: "I write my knowledge and
not report, and my witness is true, having been with him for weeks
and months together on diverse occasions, and those of the nearest
and most exercising nature, by sea and land, in this country and in
foreign countries; and I can say I never saw him out of his place, or
not a match for every service or occasion. For in all things he
acquitted himself like a man, yea, a strong man, a new and
heavenly-minded man; a divine and a naturalist, and all of God
Almighty's making."[F]
THE TESTIMONY OF WILLIAM PENN
CONCERNING THAT FAITHFUL
SERVANT
GEORGE FOX.
The blessed instrument of and in this day of God, and of whom I am
now about to write, was George Fox, distinguished from another of
that name, by that other's addition of younger to his name in all his
writings; not that he was so in years, but that he was so in the
truth; but he was also a worthy man, witness and servant of God in
his time.
But this George Fox was born in Leicestershire, about the year 1624.
He descended of honest and sufficient parents, who endeavoured to
bring him up, as they did the rest of their children, in the way and
worship of the nation; especially his mother, who was a woman
accomplished above most of her degree in the place where she
lived. But from a child he appeared of another frame of mind than
the rest of his brethren; being more religious, inward, still, solid, and
observing, beyond his years, as the answers he would give, and the
questions he would put upon occasion manifested, to the
astonishment of those that heard him, especially in divine things.
His mother taking notice of his singular temper, and the gravity,
wisdom, and piety that very early shone through him, refusing
childish and vain sports and company when very young, she was
tender and indulgent over him, so that from her he met with little
difficulty. As to his employment, he was brought up in country
business; and as he took most delight in sheep, so he was very
skilful in them; an employment that very well suited his mind in
several respects, both for its innocency and solitude; and was a just
figure of his after ministry and service.
I shall not break in upon his own account, which is by much the best
that can be given; and therefore desire, what I can, to avoid saying
anything of what is said already, as to the particular passages of his
coming forth; but, in general, when he was somewhat above twenty,
he left his friends, and visited the most retired and religious people,
and some there were at that time in this nation, especially in those
parts, who waited for the consolation of Israel night and day, as
Zacharias, Anna, and good old Simeon did of old time. To these he
was sent, and these he sought out in the neighboring countries, and
among them he sojourned till his more ample ministry came upon
him.
At this time he taught and was an example of silence, endeavouring
to bring people from self-performances, testifying and turning to the
light of Christ within them, and encouraging them to wait in patience
to feel the power of it to stir in their hearts, that their knowledge
and worship of God might stand in the power of an endless life,
which was to be found in the light, as it was obeyed in the
manifestation of it in man. "For in the Word was life, and that life
was the light of men." Life in the Word, light in men, and life too, as
the light is obeyed; the children of the light living by the life of the
Word, by which the Word begets them again to God, which is the
regeneration and new birth, without which there is no coming unto
the kingdom of God; and which, whoever comes to, is greater than
John, that is, than John's ministry, which was not that of the
kingdom, but the consummation of the legal, and opening of the
gospel-dispensation. Accordingly, several meetings were gathered in
those parts; and thus his time was employed for some years.
In 1652, he being in his usual retirement to the Lord upon a very
high mountain, in some of the hither parts of Yorkshire, as I take it,
his mind exercised towards the Lord, he had a vision of the great
work of God in the earth, and of the way that he was to go forth to
begin it. He saw people as thick as motes in the sun, that should in
time be brought home to the Lord, that there might be but one
Shepherd and one sheepfold in all the earth. There his eye was
directed northward, beholding a great people that should receive
him and his message in those parts. Upon this mountain he was
moved of the Lord to sound out his great and notable day, as if he
had been in a great auditory, and from thence went north, as the
Lord had shewn him: and in every place where he came, if not
before he came to it, he had his particular exercise and service
shewn to him, so that the Lord was his leader indeed; for it was not
in vain that he travelled, God in most places sealing his commission
with the convincement of some of all sorts, as well publicans as
sober professors of religion. Some of the first and most eminent of
them, which are at rest, were Richard Farnsworth, James Nayler,
William Dewsberry, Francis Howgil, Edward Burrough, John Camm,
John Audland, Richard Hubberthorn, T. Taylor, John Aldam, T.
Holmes, Alexander Parker, William Simpson, William Caton, John
Stubbs, Robert Widders, John Burnyeat, Robert Lodge, Thomas
Salthouse, and many more worthies, that cannot be well here
named, together with divers yet living of the first and great
convincement, who after the knowledge of God's purging judgments
in themselves, and some time of waiting in silence upon him, to feel
and receive power from on high to speak in his name (which none
else rightly can, though they may use the same words), felt the
divine motions, and were frequently drawn forth, especially to visit
the publick assemblies, to reprove, inform and exhort them,
sometimes in markets, fairs, streets, and by the highway side, calling
people to repentance, and to turn to the Lord with their hearts as
well as their mouths; directing them to the light of Christ within
them, to see and examine and consider their ways by, and to
eschew the evil and do the good and acceptable will of God. And
they suffered great hardships for this their love and good-will, being
often stocked, stoned, beaten, whipped and imprisoned, though
honest men and of good report where they lived, that had left wives
and children, and houses and lands, to visit them with a living call to
repentance. And though the priests generally set themselves to
oppose them, and write against them, and insinuated most false and
scandalous stories to defame them, stirring up the magistrates to
suppress them, especially in those northern parts, yet God was
pleased so to fill them with his living power, and give them such an
open door of utterance in his service, that there was a mighty
convincement over those parts.
And through the tender and singular indulgence of Judge Bradshaw
and Judge Fell, in the infancy of things, the priests were never able
to gain the point they laboured for, which was to have proceeded to
blood, and if possible, Herod-like, by a cruel exercise of the civil
power, to have cut them off and rooted them out of the country.
Especially Judge Fell, who was not only a check to their rage in the
course of legal proceedings, but otherwise upon occasion, and finally
countenanced this people; for his wife receiving the truth with the
first, it had that influence upon his spirit, being a just and wise man,
and seeing in his own wife and family a full confutation of all the
popular clamours against the way of truth, that he covered them
what he could, and freely opened his doors, and gave up his house
to his wife and her friends, not valuing the reproach of ignorant or
evil-minded people, which I here mention to his and her honour, and
which will be I believe an honour and a blessing to such of their
name and family as shall be found in that tenderness, humility, love
and zeal for the truth and people of the Lord.
That house was for some years at first, till the truth had opened its
way in the southern parts of this island, an eminent receptacle of
this people. Others of good note and substance in those northern
countries had also opened their houses with their hearts to the many
publishers, that in a short time the Lord had raised to declare his
salvation to the people, and where meetings of the Lord's
messengers were frequently held, to communicate their services and
exercises, and comfort and edify one another in their blessed
ministry.
But lest this may be thought a digression, having touched upon this
before, I return to this excellent man: and for his personal qualities,
both natural, moral, and divine, as they appeared in his converse
with his brethren and in the church of God, take as follows.
I. He was a man that God endowed with a clear and wonderful
depth, a discerner of others' spirits, and very much a master of his
own. And though the side of his understanding which lay next to the
world, and especially the expression of it, might sound uncouth and
unfashionable to nice ears, his matter was nevertheless very
profound, and would not only bear to be often considered, but the
more it was so, the more weighty and instructing it appeared. And
as abruptly and brokenly as sometimes his sentences would fall from
him about divine things, it is well known they were often as texts to
many fairer declarations. And indeed it shewed beyond all
contradiction that God sent him, that no arts or parts had any share
in the matter or manner of his ministry, and that so many great,
excellent, and necessary truths as he came forth to preach to
mankind, had therefore nothing of man's wit or wisdom to
recommend them. So that as to man he was an original, being no
man's copy. And his ministry and writings shew they are from one
that was not taught of man, nor had learned what he said by study.
Nor were they notional or speculative, but sensible and practical
truths, tending to conversion and regeneration, and the setting up
the kingdom of God in the hearts of men, and the way of it was his
work. So that I have many times been overcome in myself, and been
made to say with my Lord and Master upon the like occasion, "I
thank thee, O Father, Lord of heaven and earth, that thou hast hid
these things from the wise and prudent of this world, and revealed
them to babes"; for many times hath my soul bowed in an humble
thankfulness to the Lord, that he did not choose any of the wise and
learned of this world to be the first messenger in our age of his
blessed truth to men; but that he took one that was not of high
degree, or elegant speech, or learned after the way of this world,
that his message and work He sent him to do might come with less
suspicion or jealousy of human wisdom and interest, and with more
force and clearness upon the consciences of those that sincerely
sought the way of truth in the love of it. I say, beholding with the
eye of my mind, which the God of heaven had opened in me, the
marks of God's finger and hand visibly in this testimony from the
clearness of the principle, the power and efficacy of it in the
exemplary sobriety, plainness, zeal, steadiness, humility, gravity,
punctuality, charity, and circumspect care in the government of
church affairs, which shined in his and their life and testimony that
God employed in this work, it greatly confirmed me that it was of
God, and engaged my soul in a deep love, fear, reverence, and
thankfulness for his love and mercy therein to mankind; in which
mind I remain, and shall, I hope, to the end of my days.
II. In his testimony or ministry he much laboured to open truth to
the people's understandings, and to bottom them upon the principle
and principal, Christ Jesus, the light of the world, that by bringing
them to something that was of God in themselves, they might the
better know and judge of him and themselves.
He had an extraordinary gift in opening the Scriptures. He would go
to the marrow of things, and shew the mind, harmony, and fulfilling
of them with much plainness, and to great comfort and edification.
The mystery of the first and second Adam, of the fall and
restoration, of the law and gospel, of shadows and substance, of the
servant and son's state, and the fulfilling of the Scriptures in Christ,
and by Christ the true light, in all that are His, through the
obedience of faith, were much of the substance and drift of his
testimonies. In all which he was witnessed to be of God, being
sensibly felt to speak that which he had received of Christ, and was
his own experience in that which never errs nor fails.
But above all he excelled in prayer. The inwardness and weight of his
spirit, the reverence and solemnity of his address and behaviour, and
the fewness and fullness of his words, have often struck even
strangers with admiration, as they used to reach others with
consolation. The most awful, living, reverent frame I ever felt or
beheld, I must say, was his in prayer. And truly it was a testimony he
knew, and lived nearer to the Lord than other men; for they that
know him most will see most reason to approach him with reverence
and fear.
He was of an innocent life, no busy-body, nor self-seeker, neither
touchy nor critical: what fell from him was very inoffensive, if not
very edifying. So meek, contented, modest, easy, steady, tender, it
was a pleasure to be in his company. He exercised no authority but
over evil, and that everywhere and in all; but with love, compassion,
and long-suffering. A most merciful man, as ready to forgive as
unapt to take or give offence. Thousands can truly say, he was of an
excellent spirit and savour among them, and because thereof the
most excellent spirits loved him with an unfeigned and unfading
love.
He was an incessant labourer; for in his younger time, before his
many great and deep sufferings and travels had enfeebled his body
for itinerant services, he laboured much in the word and doctrine
and discipline in England, Scotland, and Ireland, turning many to
God, and confirming those that were convinced of the truth, and
settling good order as to church affairs among them. And towards
the conclusion of his travelling services, between the years seventy-
one and seventy-seven, he visited the churches of Christ in the
plantations in America, and in the United Provinces, and Germany,
as his following Journal relates, to the convincement and consolation
of many. After that time he chiefly resided in and about the city of
London, and besides the services of his ministry, which were
frequent, he wrote much both to them that are within and those that
are without the communion. But the care he took of the affairs of
the church in general was very great.
He was often where the records of the affairs of the church are kept,
and the letters from the many meetings of God's people over all the
world, where settled, come upon occasions; which letters he had
read to him, and communicated them to the meeting that is weekly
held there for such services; he would be sure to stir them up to
discharge them, especially in suffering cases: showing great
sympathy and compassion upon all such occasions, carefully looking
into the respective cases, and endeavouring speedy relief according
to the nature of them; so that the churches and any of the suffering
members thereof were sure not to be forgotten or delayed in their
desires if he were there.
As he was unwearied, so he was undaunted in his services for God
and his people; he was no more to be moved to fear than to wrath.
His behaviour at Derby, Litchfield, Appleby, before Oliver Cromwell at
Launceston, Scarborough, Worcester, and Westminster-hall, with
many other places and exercises, did abundantly evidence it to his
enemies as well as his friends.
But as in the primitive times some rose up against the blessed
apostles of our Lord Jesus Christ, even from among those that they
had turned to the hope of the gospel, and who became their
greatest trouble, so this man of God had his share of suffering from
some that were convinced by him, who through prejudice or mistake
ran against him as one that sought dominion over conscience;
because he pressed, by his presence or epistles, a ready and zealous
compliance with such good and wholesome things as tended to an
orderly conversation about the affairs of the church, and in their
walking before men. That which contributed much to this ill work,
was in some a begrudging of this meek man the love and esteem he
had and deserved in the hearts of the people, and weakness in
others that were taken with their groundless suggestions of
imposition and blind obedience.
They would have had every man independent, that as he had the
principle in himself, he should only stand and fall to that and nobody
else; not considering that the principle is one in all, and though the
measure of light or grace might differ, yet the nature of it was the
same, and being so they struck at the spiritual unity, which a people
guided by the same principle are naturally led into: so that what is
evil to one is so to all, and what is virtuous, honest, and of good
report to one, is so to all, from the sense and savour of the one
universal principle which is common to all, and (which the
disaffected profess to be) the root of all true Christian fellowship,
and that spirit into which the people of God drink, and come to be
spiritually minded, and of one heart and one soul.
Some weakly mistook good order in the government of church-
affairs for discipline in worship, and that it was so pressed or
recommended by him and other brethren; and they were ready to
reflect the same things that dissenters had very reasonably objected
upon the national churches, that have coercively pressed conformity
to their respective creeds and worships: whereas these things
related wholly to conversation, and the outward and (as I may say)
civil part of the church, that men should walk up to the principles of
their belief, and not be wanting in care and charity. But though some
have stumbled and fallen through mistakes and an unreasonable
obstinacy, even to a prejudice, yet blessed be God, the generality
have returned to their first love, and seen the work of the enemy,
that loses no opportunity or advantage by which he may check or
hinder the work of God, and disquiet the peace of His church, and
chill the love of His people to the truth, and one to another; and
there is hope of divers that are yet at a distance.
In all these occasions, though there was no person the discontented
struck so sharply at as this good man, he bore all their weakness
and prejudice, and returned not reflection for reflection; but forgave
them their weak and bitter speeches, praying for them that they
might have a sense of their hurt, and see the subtlety of the enemy
to rend and divide, and return into their first love that thought no ill.
And truly, I must say, that though God had visibly cloathed him with
a divine preference and authority, and indeed his very presence
expressed a religious majesty, yet he never abused it, but held his
place in the church of God with great meekness, and a most
engaging humility and moderation. For upon all occasions, like his
blessed Master, he was a servant to all, holding and exercising his
eldership in the invisible power that had gathered them, with
reverence to the head and care over the body, and was received
only in that spirit and power of Christ, as the first and chief elder in
this age; who as he was therefore worthy of double honour, so for
the same reason it was given by the faithful of this day; because his
authority was inward and not outward, and that he got it and kept it
by the love of God and power of an endless life. I write my
knowledge and not report, and my witness is true, having been with
him for weeks and months together on divers occasions, and those
of the nearest and most exercising nature, and that by night and by
day, by sea and by land, in this and in foreign countries: and I can
say I never saw him out of his place, or not a match for every
service or occasion.
For in all things he acquitted himself like a man, yea a strong man, a
new and heavenly-minded man. A divine, and a naturalist, and all of
God Almighty's making. I have been surprised at his questions and
answers in natural things, that whilst he was ignorant of useless and
sophistical science, he had in him the foundation of useful and
commendable knowledge, and cherished it everywhere. Civil beyond
all forms of breeding in his behaviour; very temperate, eating little
and sleeping less, though a bulky person.
Thus he lived and sojourned among us, and as he lived so he died,
feeling the same eternal power that had raised and preserved him in
his last moments. So full of assurance was he that he triumphed
over death; and so even to the last, as if death were hardly worth
notice or a mention: recommending to some with him the dispatch
and dispersion of an epistle, just before written to the churches of
Christ, throughout the world, and his own books; but above all,
friends, and of all friends those in Ireland and America, twice over:
saying, Mind poor friends in Ireland and America.
And to some that came in and inquired how he found himself, he
answered, "Never heed, the Lord's power is over all weakness and
death, the Seed reigns, blessed be the Lord": which was about four
or five hours before his departure out of this world. He was at the
great meeting near Lombard Street on the first day of the week, and
it was the third following about ten at night when he left us, being at
the house of H. Goldney in the same court. In a good old age he
went, after having lived to see his children's children to several
generations in the truth. He had the comfort of a short illness, and
the blessing of a clear sense to the last; and we may truly say with a
man of God of old, that "being dead, he yet speaketh"; and though
absent in body, he is present in Spirit; neither time nor place being
able to interrupt the communion of saints, or dissolve the fellowship
of the spirits of the just. His works praise him, because they are to
the praise of Him that worked by him; for which his memorial is and
shall be blessed. I have done, as to this part of my preface, when I
have left this short epitaph to his name: "Many sons have done
virtuously in this day, but, dear George, thou excellest them all."
CONTENTS
PAGE
Preface, 9
Introduction, 15
The Testimony of William Penn Concerning that Faithful
Servant, George Fox,
46
I. —Boyhood—A Seeker, 65
1624-1648.
II. —The First Years of Ministry, 90
1648-1649.
III. —The Challenge and the First Taste of Prison, 109
1648-1649.
IV. —A Year in Derby Jail, 118
1650-1651.
V. —One Man May Shake the Country for Ten Miles, 132
1651-1652.
VI. —A New Era Begins, 150
1652.
VII. —In Prison Again, 179
1653.
VIII. —A Visit to Oliver Cromwell, 197
1653-1654.
IX.
—A Visit to the Southern Counties, Which Ends in Launceston
Jail,
222
1655-1656.
X. —Planting the Seed in Wales, 269
1656-1657.
XI. —In the Home of the Covenanters, 297
1657.
XII. —Great Events in London, 317
1658-1659.
XIII. —In the First Year of King Charles, 331
1660.
XIV. —Labors, Dangers and Sufferings, 363
1661-1662.
XV. —In Prison for Not Swearing, 392
1662-1665.
XVI. —A Year in Scarborough Castle, 436
1665-1666.
XVII. —At the Work of Organizing, 459
1667-1670.
XVIII.—Two Years in America, 482
1671-1673.
XIX. —The Last Imprisonment, 536
1673-1678.
XX. —The Seed Reigns over Death, 562
1679-1691.
Index, 579
SQL Server Internals In Memory OLTP Inside the SQL Server 2016 Hekaton Engine 2nd Edition Kalen Delaney
CHAPTER I.
Boyhood—A Seeker.
1624-1648.
That all may know the dealings of the Lord with me, and the various
exercises, trials, and troubles through which He led me, in order to
prepare and fit me for the work unto which He had appointed me,
and may thereby be drawn to admire and glorify His infinite wisdom
and goodness, I think fit (before I proceed to set forth my public
travels in the service of Truth) briefly to mention how it was with me
in my youth, and how the work of the Lord was begun, and
gradually carried on in me, even from my childhood.
I was born in the month called July, 1624, at Drayton-in-the-Clay,[1]
in Leicestershire. My father's name was Christopher Fox; he was by
profession a weaver, an honest man; and there was a Seed of God in
him. The neighbours called him Righteous Christer. My mother was
an upright woman; her maiden name was Mary Lago, of the family
of the Lagos, and of the stock of the martyrs.[2]
In my very young years I had a gravity and stayedness of mind and
spirit not usual in children; insomuch that when I saw old men
behave lightly and wantonly towards each other, I had a dislike
thereof raised in my heart, and said within myself, "If ever I come to
be a man, surely I shall not do so, nor be so wanton."
When I came to eleven years of age I knew pureness and
righteousness; for while a child I was taught how to walk to be kept
pure. The Lord taught me to be faithful in all things, and to act
faithfully two ways, viz., inwardly, to God, and outwardly, to man;
and to keep to Yea and Nay in all things. For the Lord showed me
that, though the people of the world have mouths full of deceit, and
changeable words, yet I was to keep to Yea and Nay in all things;
and that my words should be few and savoury, seasoned with grace;
and that I might not eat and drink to make myself wanton, but for
health, using the creatures[3]
in their service, as servants in their
places, to the glory of Him that created them.
As I grew up, my relations thought to have made me a priest,[4]
but
others persuaded to the contrary. Whereupon I was put to a man
who was a shoemaker[5]
by trade, and dealt in wool. He also used
grazing, and sold cattle; and a great deal went through my hands.
While I was with him he was blessed, but after I left him he broke
and came to nothing.
I never wronged man or woman in all that time; for the Lord's power
was with me and over me, to preserve me. While I was in that
service I used in my dealings the word Verily, and it was a common
saying among those that knew me, "If George says verily, there is no
altering him." When boys and rude persons would laugh at me, I let
them alone and went my way; but people had generally a love to me
for my innocency and honesty.
When I came towards nineteen years of age, being upon business at
a fair, one of my cousins, whose name was Bradford, having another
professor[6]
with him, came and asked me to drink part of a jug of
beer with them. I, being thirsty, went in with them for I loved any
who had a sense of good, or that sought after the Lord.
When we had drunk a glass apiece, they began to drink healths, and
called for more drink, agreeing together that he that would not drink
should pay all. I was grieved that any who made profession of
religion should offer to do so. They grieved me very much, having
never had such a thing put to me before by any sort of people.
Wherefore I rose up, and, putting my hand in my pocket, took out a
groat, and laid it upon the table before them, saying, "If it be so, I
will leave you."
So I went away; and when I had done my business returned home;
but did not go to bed that night, nor could I sleep, but sometimes
walked up and down, and sometimes prayed and cried to the Lord,
who said unto me: "Thou seest how young people go together into
vanity, and old people into the earth; thou must forsake all, young
and old, keep out of all, and be as a stranger unto all."
Then, at the command of God, the ninth of the Seventh month,
1643, I left my relations, and broke off all familiarity or fellowship
with young or old. I passed to Lutterworth, where I stayed some
time. From thence I went to Northampton, where also I made some
stay; then passed to Newport-Pagnel, whence, after I had stayed
awhile, I went to Barnet, in the Fourth month, called June,[7]
in the
year 1644.
As I thus traveled through the country, professors took notice of me,
and sought to be acquainted with me; but I was afraid of them, for I
was sensible they did not possess what they professed.
During the time I was at Barnet a strong temptation to despair came
upon me. I then saw how Christ was tempted, and mighty troubles I
was in. Sometimes I kept myself retired to my chamber, and often
walked solitary in the Chase to wait upon the Lord. I wondered why
these things should come to me. I looked upon myself, and said,
"Was I ever so before?" Then I thought, because I had forsaken my
relations I had done amiss against them.
So I was brought to call to mind all my time that I had spent, and to
consider whether I had wronged any; but temptations grew more
and more, and I was tempted almost to despair; and when Satan
could not effect his design upon me that way, he laid snares and
baits to draw me to commit some sin, whereof he might take
advantage to bring me to despair.
I was about twenty years of age when these exercises came upon
me; and some years I continued in that condition, in great trouble;
and fain I would have put it from me. I went to many a priest to
look for comfort, but found no comfort from them.
From Barnet I went to London, where I took a lodging, and was
under great misery and trouble there; for I looked upon the great
professors of the city of London, and saw all was dark and under the
chain of darkness. I had an uncle there, one Pickering, a Baptist; the
Baptists were tender[8]
then; yet I could not impart my mind to him,
nor join with them; for I saw all, young and old, where they were.
Some tender people would have had me stay, but I was fearful, and
returned homeward into Leicestershire, having a regard upon my
mind to my parents and relations, lest I should grieve them, for I
understood they were troubled at my absence.
Being returned[9]
into Leicestershire, my relations would have had
me married; but I told them I was but a lad, and must get wisdom.
Others would have had me join the auxiliary band among the
soldiery,[G]
but I refused, and was grieved that they offered such
things to me, being a tender youth. Then I went to Coventry, where
I took a chamber for awhile at a professor's house, till people began
to be acquainted with me, for there were many tender people in that
town. After some time I went into my own country again, and
continued about a year, in great sorrow and trouble, and walked
many nights by myself.
Then the priest of Drayton, the town of my birth, whose name was
Nathaniel Stephens, came often to me, and I went often to him; and
another priest sometimes came with him; and they would give place
to me, to hear me; and I would ask them questions, and reason with
them. This priest, Stephens, asked me why Christ cried out upon the
cross, "My God, my God, why hast thou forsaken me?" and why He
said, "If it be possible, let this cup pass from me; yet not my will,
but thine, be done"? I told him that at that time the sins of all
mankind were upon Him, and their iniquities and transgressions,
with which He was wounded; which He was to bear, and to be an
offering for, as He was man; but died not, as He was God; so, in that
He died for all men, tasting death for every man, He was an offering
for the sins of the whole world.
This I spoke, being at that time in a measure sensible of Christ's
sufferings. The priest said it was a very good, full answer, and such a
one as he had not heard. At that time he would applaud and speak
highly of me to others; and what I said in discourse to him on week-
days, he would preach of on First-days,[10]
which gave me a dislike
to him. This priest afterwards became my great persecutor.
After this I went to another ancient priest[H]
at Mancetter, in
Warwickshire, and reasoned with him about the ground of despair
and temptations. But he was ignorant of my condition; he bade me
take tobacco and sing psalms. Tobacco was a thing I did not love,
and psalms I was not in a state to sing; I could not sing. He bade
me come again, and he would tell me many things; but when I came
he was angry and pettish, for my former words had displeased him.
He told my troubles, sorrows, and griefs to his servants, so that it
got out among the milk-lasses. It grieved me that I should have
opened my mind to such a one. I saw they were all miserable
comforters, and this increased my troubles upon me. I heard of a
priest living about Tamworth, who was accounted an experienced
man. I went seven miles to him, but found him like an empty, hollow
cask.
I heard also of one called Dr. Cradock, of Coventry, and went to him.
I asked him the ground of temptations and despair, and how
troubles came to be wrought in man? He asked me, "Who were
Christ's father and mother?" I told him, Mary was His mother, and
that He was supposed to be the Son of Joseph, but He was the Son
of God.
Now, as we were walking together in his garden, the alley being
narrow, I chanced, in turning, to set my foot on the side of a bed, at
which the man was in a rage, as if his house had been on fire. Thus
all our discourse was lost, and I went away in sorrow, worse than I
was when I came. I thought them miserable comforters, and saw
they were all as nothing to me, for they could not reach my
condition.
After this I went to another, one Macham,[I]
a priest in high account.
He would needs give me some physic, and I was to have been let
blood; but they could not get one drop of blood from me, either in
arms or head (though they endeavoured to do so), my body being,
as it were, dried up with sorrows, grief and troubles, which were so
great upon me that I could have wished I had never been born, or
that I had been born blind, that I might never have seen wickedness
or vanity; and deaf, that I might never have heard vain and wicked
words, or the Lord's name blasphemed.
When the time called Christmas came, while others were feasting
and sporting themselves I looked out poor widows from house to
house, and gave them some money. When I was invited to
marriages (as I sometimes was), I went to none at all; but the next
day, or soon after, I would go and visit them, and if they were poor I
gave them some money; for I had wherewith both to keep myself
from being chargeable to others and to administer something to the
necessities of those who were in need.[11]
About the beginning of the year 1646, as I was going to Coventry,
and approaching towards the gate, a consideration arose in me, how
it was said that "All Christians are believers, both Protestants and
Papists"; and the Lord opened[12]
to me that if all were believers,
then they were all born of God, and passed from death to life; and
that none were true believers but such; and, though others said they
were believers, yet they were not. At another time, as I was walking
in a field on a First-day morning, the Lord opened unto me that
being bred at Oxford or Cambridge was not enough to fit and qualify
men to be ministers of Christ; and I wondered at it, because it was
the common belief of people. But I saw it clearly as the Lord opened
it unto me, and was satisfied, and admired the goodness of the
Lord, who had opened this thing unto me that morning. This struck
at priest Stephens's ministry, namely, that "to be bred at Oxford or
Cambridge was not enough to make a man fit to be a minister of
Christ." So that which opened in me I saw struck at the priest's
ministry.
But my relations were much troubled that I would not go with them
to hear the priest; for I would go into the orchard or the fields, with
my Bible, by myself. I asked them, "Did not the Apostle say to
believers that they needed no man to teach them, but as the
anointing teacheth them?" Though they knew this was Scripture,
and that it was true, yet they were grieved because I could not be
subject in this matter, to go to hear the priest with them. I saw that
to be a true believer was another thing than they looked upon it to
be; and I saw that being bred at Oxford or Cambridge did not qualify
or fit a man to be a minister of Christ; what then should I follow
such for? So neither them, nor any of the dissenting people, could I
join with; but was as a stranger to all, relying wholly upon the Lord
Jesus Christ.
At another time it was opened in me that God, who made the world,
did not dwell in temples made with hands. This at first seemed a
strange word, because both priests and people used to call their
temples, or churches, dreadful places, holy ground, and the temples
of God. But the Lord showed me clearly that He did not dwell in
these temples which men had commanded and set up, but in
people's hearts; for both Stephen and the apostle Paul bore
testimony that He did not dwell in temples made with hands, not
even in that which He had once commanded to be built, since He
put an end to it; but that His people were His temple, and He dwelt
in them.
This opened in me as I walked in the fields to my relations' house.
When I came there they told me that Nathaniel Stephens, the priest,
had been there, and told them he was afraid of me, for going after
new lights. I smiled in myself, knowing what the Lord had opened in
me concerning him and his brethren; but I told not my relations,
who, though they saw beyond the priests, yet went to hear them,
and were grieved because I would not go also. But I brought them
Scriptures,[J]
and told them there was an anointing within man to
teach him, and that the Lord would teach His people Himself.
I had also great openings concerning the things written in the
Revelations; and when I spoke of them the priests and professors
would say that was a sealed book, and would have kept me out of it.
But I told them Christ could open the seals, and that they were the
nearest things to us; for the epistles were written to the saints that
lived in former ages, but the Revelations were written of things to
come.
After this I met with a sort of people that held women have no
souls, (adding in a light manner), No more than a goose.[13]
But I
reproved them, and told them that was not right; for Mary said, "My
soul doth magnify the Lord, and my spirit hath rejoiced in God my
Saviour."
Removing to another place, I came among a people that relied much
on dreams. I told them, except they could distinguish between
dream and dream, they would confound all together; for there were
three sorts of dreams; multitude of business sometimes caused
dreams, and there were whisperings of Satan in man in the night
season; and there were speakings of God to man in dreams. But
these people came out of these things, and at last became Friends.
[14]
Now, though I had great openings, yet great trouble and temptation
came many times upon me; so that when it was day I wished for
night, and when it was night I wished for day; and by reason of the
openings I had in my troubles, I could say as David said, "Day unto
day uttereth speech, and night unto night showeth knowledge."
When I had openings they answered one another and answered the
Scriptures; for I had great openings of the Scriptures: and when I
was in troubles, one trouble also answered to another.
About the beginning of the year 1647 I was moved of the Lord to go
into Derbyshire, where I met with some friendly people, and had
many discourses with them. Then, passing into the Peak country,[15]
I met with more friendly people, and with some in empty high
notions.[16]
Travelling through some parts of Leicestershire, and into
Nottinghamshire, I met with a tender people, and a very tender
woman, whose name was Elizabeth Hooton.[17]
With these I had
some meetings and discourses; but my troubles continued, and I
was often under great temptations.
I fasted much, walked abroad in solitary places many days, and
often took my Bible, and sat in hollow trees and lonesome places till
night came on; and frequently in the night walked mournfully about
by myself; for I was a man of sorrows in the time of the first
workings of the Lord in me.
During all this time I was never joined in profession of religion with
any, but gave up myself to the Lord, having forsaken all evil
company, taken leave of father and mother, and all other relations,
and travelled up and down as a stranger in the earth, which way the
Lord inclined my heart; taking a chamber to myself in the town
where I came, and tarrying, sometimes more, sometimes less, in a
place. For I durst not stay long in a place, being afraid both of
professor and profane, lest, being a tender young man, I should be
hurt by conversing much with either. For this reason I kept much as
a stranger, seeking heavenly wisdom and getting knowledge from
the Lord, and was brought off from outward things to rely on the
Lord alone.
Though my exercises and troubles were very great, yet were they
not so continual but that I had some intermissions, and I was
sometimes brought into such an heavenly joy that I thought I had
been in Abraham's bosom.
As I cannot declare the misery I was in, it was so great and heavy
upon me, so neither can I set forth the mercies of God unto me in all
my misery. O the everlasting love of God to my soul, when I was in
great distress! When my troubles and torments were great, then was
His love exceeding great. Thou, Lord, makest a fruitful field a barren
wilderness, and a barren wilderness a fruitful field! Thou bringest
down and settest up! Thou killest and makest alive! all honour and
glory be to thee, O Lord of Glory! The knowledge of Thee in the
Spirit is life; but that knowledge which is fleshly works death.[18]
While there is this knowledge in the flesh, deceit and self will
conform to anything, and will say Yes, Yes, to that it doth not know.
The knowledge which the world hath of what the prophets and
apostles spake, is a fleshly knowledge; and the apostates from the
life in which the prophets and apostles were have got their words,
the Holy Scriptures, in a form, but not in the life nor spirit that gave
them forth. So they all lie in confusion; and are making provision for
the flesh, to fulfil the lusts thereof, but not to fulfil the law and
command of Christ in His power and Spirit. For that they say they
cannot do; but to fulfil the lusts of the flesh, that they can do with
delight.
Now, after I had received that opening from the Lord, that to be
bred at Oxford or Cambridge was not sufficient to fit a man to be a
minister of Christ, I regarded the priests less, and looked more after
the Dissenting people.[K]
Among them I saw there was some
tenderness; and many of them came afterwards to be convinced, for
they had some openings.
But as I had forsaken the priests, so I left the separate preachers
also, and those esteemed the most experienced people; for I saw
there was none among them all that could speak to my condition.
When all my hopes in them and in all men were gone, so that I had
nothing outwardly to help me, nor could I tell what to do, then, oh,
then, I heard a voice which said, "There is one, even Christ Jesus,
that can speak to thy condition";[19]
and when I heard it, my heart
did leap for joy.
Then the Lord let me see why there was none upon the earth that
could speak to my condition, namely, that I might give Him all the
glory. For all are concluded under sin, and shut up in unbelief, as I
had been; that Jesus Christ might have the pre-eminence, who
enlightens, and gives grace, and faith, and power. Thus when God
doth work, who shall hinder it? and this I knew experimentally.
My desire after the Lord grew stronger, and zeal in the pure
knowledge of God, and of Christ alone, without the help of any man,
book, or writing. For though I read the Scriptures that spoke of
Christ and of God, yet I knew Him not, but by revelation, as He who
hath the key did open, and as the Father of Life drew me to His Son
by His Spirit. Then the Lord gently led me along, and let me see His
love, which was endless and eternal, surpassing all the knowledge
that men have in the natural state, or can obtain from history or
books; and that love let me see myself, as I was without Him.
I was afraid of all company, for I saw them perfectly where they
were, through the love of God, which let me see myself. I had not
fellowship with any people, priests or professors, or any sort of
separated people, but with Christ, who hath the key, and opened the
door of Light and Life unto me. I was afraid of all carnal talk and
talkers, for I could see nothing but corruptions, and the life lay
under the burthen of corruptions.
When I myself was in the deep, shut up under all, I could not
believe that I should ever overcome; my troubles, my sorrows, and
my temptations were so great that I thought many times I should
have despaired, I was so tempted. But when Christ opened to me
how He was tempted by the same devil, and overcame him and
bruised his head, and that through Him and His power, light, grace,
and Spirit, I should overcome also, I had confidence in Him; so He it
was that opened to me when I was shut up and had no hope nor
faith. Christ, who had enlightened me, gave me His light to believe
in; He gave me hope, which He Himself revealed in me, and He gave
me His Spirit and grace, which I found sufficient in the deeps and in
weakness.
Thus, in the deepest miseries, and in the greatest sorrows and
temptations, that many times beset me, the Lord in His mercy did
keep me.
I found that there were two thirsts in me—the one after the
creatures, to get help and strength there, and the other after the
Lord, the Creator, and His Son Jesus Christ. I saw all the world could
do me no good; if I had had a king's diet, palace, and attendance,
all would have been as nothing; for nothing gave me comfort but the
Lord by His power. At another time I saw the great love of God, and
was filled with admiration at the infiniteness of it.
One day, when I had been walking solitarily abroad, and was come
home, I was taken up in the love of God, so that I could not but
admire the greatness of His love; and while I was in that condition,
it was opened unto me by the eternal light and power, and I therein
clearly saw that all was done and to be done in and by Christ, and
how He conquers and destroys this tempter the devil, and all his
works, and is atop of him; and that all these troubles were good for
me, and temptations for the trial of my faith, which Christ had given
me.
The Lord opened me, that I saw all through these troubles and
temptations. My living faith was raised, that I saw all was done by
Christ the life, and my belief was in Him.
When at any time my condition was veiled, my secret belief was
stayed firm, and hope underneath held me, as an anchor in the
bottom of the sea, and anchored my immortal soul to its Bishop,
causing it to swim above the sea, the world, where all the raging
waves, foul weather, tempests and temptations are. But O! then did
I see my troubles, trials, and temptations more clearly than ever I
had done. As the light appeared all appeared that is out of the light;
darkness, death, temptations, the unrighteous, the ungodly; all was
manifest and seen in the light.
I heard of a woman in Lancashire that had fasted two and twenty
days, and I travelled to see her; but when I came to her I saw that
she was under a temptation. When I had spoken to her what I had
from the Lord, I left her, her father being one high in profession.
Passing on, I went among the professors at Duckingfield and
Manchester, where I stayed awhile, and declared truth among them.
There were some convinced who received the Lord's teaching, by
which they were confirmed and stood in the truth. But the
professors were in a rage, all pleading for sin and imperfection, and
could not endure to hear talk of perfection, and of a holy and sinless
life.[20]
But the Lord's power was over all, though they were chained
under darkness and sin, which they pleaded for, and quenched the
tender thing in them.
About this time there was a great meeting of the Baptists, at
Broughton, in Leicestershire, with some that had separated from
them, and people of other notions went thither, and I went also. Not
many of the Baptists came, but many others were there. The Lord
opened my mouth, and the everlasting truth was declared amongst
them, and the power of the Lord was over them all. For in that day
the Lord's power began to spring, and I had great openings in the
Scriptures. Several were convinced in those parts and were turned
from darkness to light, from the power of Satan unto God, and many
were raised up to praise God. When I reasoned with professors and
other people, some became convinced.
I went back into Nottinghamshire, and there the Lord showed me
that the natures of those things, which were hurtful without, were
within, in the hearts and minds of wicked men. The natures of dogs,
swine, vipers, of Sodom and Egypt, Pharaoh, Cain, Ishmael, Esau,
etc.; the natures of these I saw within, though people had been
looking without. I cried to the Lord, saying, "Why should I be thus,[L]
seeing I was never addicted to commit those evils?" and the Lord
answered, "That it was needful I should have a sense of all
conditions, how else should I speak to all conditions!" and in this I
saw the infinite love of God.
I saw, also, that there was an ocean of darkness and death; but an
infinite ocean of light and love, which flowed over the ocean of
darkness. In that also I saw the infinite love of God, and I had great
openings.
Then came people from far and near to see me; but I was fearful of
being drawn out by them; yet I was made to speak, and open things
to them. There was one Brown, who had great prophecies and
sights upon his death-bed of me. He spoke only of what I should be
made instrumental by the Lord to bring forth. And of others he
spoke, that they should come to nothing, which was fulfilled on
some, who then were something in show.
When this man was buried a great work of the Lord fell upon me, to
the admiration of many, who thought I had been dead, and many
came to see me for about fourteen days. I was very much altered in
countenance and person, as if my body had been new moulded or
changed.[21]
My sorrows and troubles began to wear off, and tears of
joy dropped from me, so that I could have wept night and day with
tears of joy to the Lord, in humility and brokenness of heart.
I saw into that which was without end, things which cannot be
uttered, and of the greatness and infinitude of the love of God,
which cannot be expressed by words. For I had been brought
through the very ocean of darkness and death, and through and
over the power of Satan, by the eternal, glorious power of Christ;
even through that darkness was I brought, which covered over all
the world, and which chained down all and shut up all in death. The
same eternal power of God, which brought me through these things,
was that which afterwards shook the nations, priests, professors and
people.
Then could I say I had been in spiritual Babylon, Sodom, Egypt, and
the grave; but by the eternal power of God I was come out of it, and
was brought over it, and the power of it, into the power of Christ. I
saw the harvest white, and the seed of God lying thick in the
ground, as ever did wheat that was sown outwardly, and none to
gather it; for this I mourned with tears.
A report went abroad of me, that I was a young man that had a
discerning spirit; whereupon many came to me, from far and near,
professors, priests, and people. The Lord's power broke forth, and I
had great openings and prophecies, and spoke unto them of the
things of God, which they heard with attention and silence, and went
away and spread the fame thereof.
Then came the tempter and set upon me again, charging me that I
had sinned against the Holy Ghost; but I could not tell in what. Then
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
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.
Let us accompany you on the journey of exploring knowledge and
personal growth!
textbookfull.com

More Related Content

Similar to SQL Server Internals In Memory OLTP Inside the SQL Server 2016 Hekaton Engine 2nd Edition Kalen Delaney (20)

PPTX
Novidades do SQL Server 2016
Marcos Freccia
 
PDF
SQL Server 2019 CTP2.4
Gianluca Hotz
 
PPTX
Hekaton introduction for .Net developers
Shy Engelberg
 
PPTX
SQL 2014 In-Memory OLTP
Amber Keyse
 
PPTX
SQL Server In-Memory Internals and Performance Tips
Hamid J. Fard
 
PDF
In-memory ColumnStore Index
SolidQ
 
PPT
Performance dreams of sql server 2014
Shehap Elnagar
 
PPTX
Gs08 modernize your data platform with sql technologies wash dc
Bob Ward
 
PPTX
SQL Server 2014 Extreme Transaction Processing (Hekaton) - Basics
Tony Rogerson
 
PPTX
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
Bob Ward
 
PPTX
Expert summit SQL Server 2016
Łukasz Grala
 
PPTX
SQL Server 2014 Memory Optimised Tables - Advanced
Tony Rogerson
 
PPTX
Inside SQL Server In-Memory OLTP
Bob Ward
 
POTX
Business Insight 2014 - Microsofts nye BI og database platform - Erling Skaal...
Microsoft
 
PDF
Exploring sql server 2016
Antonios Chatzipavlis
 
PPTX
Diving into sql server 2016
Mohamed Zaatar - MSc
 
PPTX
Sql server 2016 it just runs faster sql bits 2017 edition
Bob Ward
 
PDF
SQL Server 2016 Everything built-in FULL deck
Hamid J. Fard
 
PPTX
Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]
ITCamp
 
PDF
SQL Server 2019 CTP 2.5
Gianluca Hotz
 
Novidades do SQL Server 2016
Marcos Freccia
 
SQL Server 2019 CTP2.4
Gianluca Hotz
 
Hekaton introduction for .Net developers
Shy Engelberg
 
SQL 2014 In-Memory OLTP
Amber Keyse
 
SQL Server In-Memory Internals and Performance Tips
Hamid J. Fard
 
In-memory ColumnStore Index
SolidQ
 
Performance dreams of sql server 2014
Shehap Elnagar
 
Gs08 modernize your data platform with sql technologies wash dc
Bob Ward
 
SQL Server 2014 Extreme Transaction Processing (Hekaton) - Basics
Tony Rogerson
 
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
Bob Ward
 
Expert summit SQL Server 2016
Łukasz Grala
 
SQL Server 2014 Memory Optimised Tables - Advanced
Tony Rogerson
 
Inside SQL Server In-Memory OLTP
Bob Ward
 
Business Insight 2014 - Microsofts nye BI og database platform - Erling Skaal...
Microsoft
 
Exploring sql server 2016
Antonios Chatzipavlis
 
Diving into sql server 2016
Mohamed Zaatar - MSc
 
Sql server 2016 it just runs faster sql bits 2017 edition
Bob Ward
 
SQL Server 2016 Everything built-in FULL deck
Hamid J. Fard
 
Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]
ITCamp
 
SQL Server 2019 CTP 2.5
Gianluca Hotz
 

Recently uploaded (20)

PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Horarios de distribución de agua en julio
pegazohn1978
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
Dimensions of Societal Planning in Commonism
StefanMz
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Ad

SQL Server Internals In Memory OLTP Inside the SQL Server 2016 Hekaton Engine 2nd Edition Kalen Delaney

  • 1. SQL Server Internals In Memory OLTP Inside the SQL Server 2016 Hekaton Engine 2nd Edition Kalen Delaney download https://textbookfull.com/product/sql-server-internals-in-memory- oltp-inside-the-sql-server-2016-hekaton-engine-2nd-edition-kalen- delaney/ Download more ebook from https://textbookfull.com
  • 2. We believe these products will be a great fit for you. Click the link to download now, or visit textbookfull.com to discover even more! Expert SQL Server In-Memory OLTP 2nd Edition Dmitri Korotkevitch https://textbookfull.com/product/expert-sql-server-in-memory- oltp-2nd-edition-dmitri-korotkevitch/ Pro SQL Server Internals 2nd Edition Dmitri Korotkevitch https://textbookfull.com/product/pro-sql-server-internals-2nd- edition-dmitri-korotkevitch/ Expert SQL Server Transactions and Locking: Concurrency Internals for SQL Server Practitioners 1st Edition Dmitri Korotkevitch https://textbookfull.com/product/expert-sql-server-transactions- and-locking-concurrency-internals-for-sql-server- practitioners-1st-edition-dmitri-korotkevitch/ SQL Server Execution Plans For SQL Server 2008 through to 2017 and Azure SQL Database 3rd Edition Grant Fritchey https://textbookfull.com/product/sql-server-execution-plans-for- sql-server-2008-through-to-2017-and-azure-sql-database-3rd- edition-grant-fritchey/
  • 3. SQL Server 2016 Developer s Guide 1st Edition Dejan Sarka https://textbookfull.com/product/sql-server-2016-developer-s- guide-1st-edition-dejan-sarka/ Microsoft SQL Server 2016 a beginner's guide Sixth Edition Petkovic https://textbookfull.com/product/microsoft-sql- server-2016-a-beginners-guide-sixth-edition-petkovic/ Building Custom Tasks for SQL Server Integration Services: The Power of .NET for ETL for SQL Server 2019 and Beyond 2nd Edition Andy Leonard https://textbookfull.com/product/building-custom-tasks-for-sql- server-integration-services-the-power-of-net-for-etl-for-sql- server-2019-and-beyond-2nd-edition-andy-leonard/ Securing SQL Server: DBAs Defending the Database 2nd Edition Peter A. Carter https://textbookfull.com/product/securing-sql-server-dbas- defending-the-database-2nd-edition-peter-a-carter/ Azure SQL Revealed: A Guide to the Cloud for SQL Server Professionals Bob Ward https://textbookfull.com/product/azure-sql-revealed-a-guide-to- the-cloud-for-sql-server-professionals-bob-ward/
  • 4. Inside the SQL Server 2016 Hekaton Engine SQL Server Internals: In-Memory OLTP By Kalen Delaney Second Edition
  • 5. SQL Server Internals: In-Memory OLTP Inside the SQL Server 2016 Hekaton Engine By Kalen Delaney Foreword by Rimma Nehme, Microsoft Technical Review by Benjamin Nevarez Technical Edit by Tony Davis First published by Simple Talk Publishing 2017
  • 6. Copyright © Kalen Delaney 2017 ISBN 978-1-910035-19-1 The right of Kalen Delaney to be identified as the author of this work has been asserted by her in accordance with the Copyright, Designs and Patents Act 1988. All rights reserved. No part of this publication may be reproduced, stored or introduced into a retrieval system, or transmitted, in any form, or by any means (electronic, mechanical, photocopying, recording or otherwise) without the prior written consent of the publisher. Any person who does any unauthorized act in relation to this publica- tion may be liable to criminal prosecution and civil claims for damages. This book is sold subject to the condition that it shall not, by way of trade or otherwise, be lent, re-sold, hired out, or otherwise circulated without the publisher's prior consent in any form other than which it is published and without a similar condition including this condition being imposed on the subsequent publisher. Cover Image: Andy Martin. Typeset by Gower Associates.
  • 7. Contents Introduction 16 1: What's Special About In-Memory OLTP? 20 Isn't In-Memory OLTP Just an Improved DBCC PINTABLE? 20 The In-Memory OLTP Component 21 Memory-optimized tables 22 Entirely in-memory storage 22 Row-based storage structure 23 Native compilation of tables 24 Natively compiled stored procedures 24 Concurrency improvements: the MVCC model 25 Indexes on memory-optimized tables 26 Data durability and recovery 27 Performance 29 What's New for In-Memory OLTP in SQL Server 2016 30 SQL Server In-Memory OLTP in Context 31 Summary 33 Additional Resources 34
  • 8. Chapter 2: Creating and Accessing In-Memory OLTP Databases and Tables 35 Creating Databases 35 Azure SQL Database 37 Creating Tables 38 Durability 39 Indexes and constraints 39 Data type restrictions 41 Creating Table Types and Table Variables 42 Altering Memory-Optimized Tables 43 Accessing Memory-Optimized Tables with T-SQL 46 Interpreted T-SQL 46 T-SQL in natively compiled procedures 47 Memory Allocation for Memory-Optimized Tables and Indexes 48 Summary 52 Additional Resources 53 Chapter 3: Row Structure and Multi-Versioning 54 Row Structure 54 Row header 55 Payload area 56 Row Versions, Timestamps and the MVCC Model 56
  • 9. Transaction IDs and timestamps 56 Row versions and transaction processing phases 58 Processing phase 59 Validation phase 62 Post-processing 62 Summary 64 Additional Resources 64 Chapter 4: Indexes on Memory-Optimized Tables 65 Nonclustered and Hash and Range Indexes 65 Hash indexes 67 Row organization 68 Choosing hash indexes 71 Determining the number of hash buckets 72 Range indexes 73 The Bw-tree 74 Index page structures 77 Internal index maintenance operations 78 Columnstore Indexes 86 Columnstore index basic architecture 86 Clustered columnstore indexes on memory-optimized tables 88
  • 10. Updating columnstore indexes 88 Examining index metadata for a columnstore index on a memory-optimized table 91 Examining Index Metadata 95 Indexes on Temporal Tables 97 Summary 97 Additional Resources 98 Chapter 5: Transaction Processing 99 Transaction Scope 99 Transaction Isolation Levels 100 Isolation levels with disk-based tables 101 Isolation levels with memory-optimized tables 102 Rules for cross-container transactions (interpreted T-SQL) 103 READ COMMITTED cross-container transactions must specify a valid isolation level 104 SNAPSHOT cross-container transactions cannot access memory-optimized tables 106 REPEATABLE READ or SERIALIZABLE cross-container transactions must use SNAPSHOT 107 Choosing an isolation level for accessing memory-optimized tables 109 Monitoring Active Transactions 110 Transaction Processing Examples 111
  • 11. Write-write conflicts 112 Read-write conflicts 113 Validation Phase 116 Validation phase, Step 1: Check for isolation level violations 117 SNAPSHOT isolation level violations 117 REPEATABLE READ isolation level violations 119 SERIALIZABLE isolation level violations 119 Validation of foreign keys 120 Validation phase, Step 2: Commit dependencies 120 Validation phase, Step 3: Logging 121 Post-processing 123 Garbage Collection of Rows in Memory 123 Summary 126 Additional Resources 127 Chapter 6: Logging, Checkpoint, and Recovery 128 Transaction Logging 129 Scalability: multiple concurrent log streams 129 Performance: reduced logging 130 Checkpoint 135 Anatomy of checkpoint files 136
  • 12. Continuous checkpointing and checkpoint events 140 Checkpoint file metadata states 141 The checkpoint event 147 The threads and tasks comprising the full checkpoint process 149 Merging checkpoint files 150 Automatic merge 151 Garbage collection of checkpoint files 154 Recovery 155 Summary 156 Additional Resources 156 Chapter 7: Native Compilation of Tables and Native Modules 157 What Is Native Compilation? 157 Maintenance of DLLs 158 Native Compilation of Tables 159 Native Compilation of Modules 160 Parameter Sniffing 162 Compilation and Query Processing 163 Optimization of Natively Compiled Modules 164 Index access paths 165 Hash indexes 165
  • 13. Range indexes 166 No Halloween protection 166 No automatic recompile 166 Best Practices with Natively Compiled Procedures 167 Performance Comparisons 168 Comparing performance for multi-row inserts 168 Performance analysis using DMV data 173 Summary 174 Additional Resources 174 Chapter 8: SQL Server Support and Manageability 175 Feature Support 176 Memory Allocation and Management 179 Using Resource Governor for memory management 180 Memory usage report 182 Metadata Enhancements and Additions 183 Catalog view enhancements 183 Dynamic Management Objects 184 Extended events 187 Performance counters 188 Best Practices for Designing Memory-Optimized Tables and Indexes 189
  • 14. Best Practices for Managing Statistics on Memory-Optimized Tables 191 Migration Considerations 191 Common application bottlenecks that in-memory OLTP can resolve 192 Application requirements compatible with migration to in-memory OLTP 193 High volume of INSERTs 193 High volume of SELECTs 194 CPU-intensive operations 194 Extremely fast business transactions 195 Session state management 195 Unsuitable application requirements 196 Current applications 197 The migration process 198 Workload analysis and baselining 198 Summary 200 Additional Resources 201
  • 15. Foreword Rimma V. Nehme, Technical Assistant Data Group at Microsoft Bellevue, WA It is my great pleasure to write a foreword to Kalen's book, SQL Server Internals: In-Memory OLTP, Inside the SQL Server 2016 Hekaton Engine. Kalen has been working with SQL Server for over 29 years, and even after three decades of working with the SQL Server technology, she is still very excited to teach, write, and share her knowledge about SQL Server. She is one of the best-respected technology writers, and her Twitter handle, @ sqlqueen, says it best. I remember when I first started developing for the SQL Server engine, many years ago, as an intern at Microsoft, I complemented all of our internal documentation with her Inside SQL Server book. Who knows, maybe if not for that book, I might have not excelled at my internship, which eventually led to an incredibly rewarding career working inside the SQL Server engine. Thank you, Kalen! This book, SQL Server Internals: In-Memory OLTP is a true gem for modern data devel- opers and data professionals. It contains an unprecedented level of details about the in-memory technology of SQL Server. In my many conversations with customers, I often hear a confusion between the terms "In-Memory" and "Memory-Optimized." Many think that they are one and the same. If you continue reading this book, you will realize the distinction. In-Memory OLTP is a game changer for relational databases, and especially for OLTP systems. Processors are not getting dramatically faster, but the number of cores and the amount of memory is increasing drastically. Machines with terabytes of memory are becoming a commodity. Over the last 30 years, memory prices have dropped by a factor of 10 every 5 years. Both core counts and memory sizes are increasing at an accelerated pace. The majority of OLTP databases fit entirely in 1 TB and even the largest OLTP databases can keep the active working set in memory. A technology that takes advantage of this ever- changing hardware landscape is Microsoft's in-memory OLTP. To understand this better, let us travel back in time a few years to when the sizes of OLTP databases were much larger than the memory available on the server. For example, your OLTP database could be 500 GB while your SQL Server has 128 GB of memory. We all know the familiar strategy to address this, by storing data and indexes in smaller chunks, xii
  • 16. or pages. SQL Server supports 8 K pages. These pages are read and written in and out of memory using sophisticated heuristics implemented as part of the buffer pool in SQL Server. When running a query, if the page containing the requested row(s) is not found in the buffer pool, an explicit physical I/O is incurred to bring it into memory. This explicit physical I/O can significantly reduce query performance. Today, you can get around this issue by buying a server machine with terabytes of physical memory and keeping your entire 500 GB database in memory, effectively removing any bottleneck due to I/O. However, the more important question to be asked is: "Is your database optimized for being in-memory?" This book will teach you how to do it. Another aspect to consider is locking and latching, and its impact on performance. When you query your data, SQL Server loads data pages in-memory and keeps them there until it needs more memory for something else. But traditional tables are still optimized for disk access, a slow medium. As such, it has a variety of bottlenecks. A big issue is the contention due to the different locking mechanisms. Each time a transaction reads data, it acquires a read lock on that data. When another transaction wants to write on the same data, it must acquire a write-lock and therefore wait for the first transaction to complete, since you can't write while data is being read. SQL Server also implements latches and spinlocks at different granularity levels. All those locking mechanisms take time to manage and, moreover, they again jeop- ardize the performance. From the ground up, in-memory OLTP is designed for high levels of concurrency. Any thread can access any row in a table without acquiring latches or locks. The engine uses latch-free and lock-free data structures to avoid physical interference among threads and a new optimistic, multi-version concurrency control technique to avoid interfer- ence among transactions using a state-of-the-art lock- and latch-free implementation. This book describes all of the key aspects of the in-memory OLTP technology that can help improve the performance of your transactional workloads, including: • new data structures and data access methods built around the assumption that the active working set resides in memory • lock- and latch-free implementation that provides high scalability • native compilation of T-SQL for more efficient transaction processing. Announced several years ago, in-memory OLTP has been implemented in production by numerous companies. Whether you need to support a high data insert rate for system telem- etry or smart metering, or get high read performance at scale for social network browsing, or do compute-heavy data processing for manufacturing or retail supply chains, or achieve xiii
  • 17. low latency for online gaming platforms or capital markets, or do session management for heavily-visited websites, in-memory OLTP can help you. One of the best things about this technology is that it is not all or nothing. The in-memory OLTP engine is integrated into SQL Server; it is not a separate DBMS. Even if much of your processing is not OLTP, even if your total system memory is nowhere near the terabyte range, you can still choose one or more critical tables to migrate to the new in-memory structures. You can also choose a frequently- run stored procedure to recreate as a natively compiled procedure. And you can get measur- able performance improvements as a result! About the Author Kalen Delaney has been working with SQL Server since 1987, and provides advanced SQL Server training to clients worldwide. She has been a SQL Server MVP since 1993 and has been writing about SQL Server almost as long. Kalen has spoken at dozens of technical conferences, including almost every PASS conference in the US since the organization's founding in 1999. Kalen is the author or co-author of many books on SQL Server, including SQL Server 2012 Internals, from Microsoft Press and SQL Server Internals: In-Memory OLTP (version 2014), from Red Gate. She is one of the main editors for SQL Server Central's SQL Server Stairways Series, www.sqlservercentral.com/stairway. Kalen blogs at www.sqlblog.com and her personal website and schedule can be found at www.SQLServerInternals.com. Acknowledgements First of all, I would like to thank Kevin Liu, formerly with Microsoft, who brought me onboard with the Hekaton project at the end of 2012, with the goal of providing in-depth white papers describing this exciting new technology. Under Kevin's guidance, I wrote two white papers, which were published near the release date at each of the CTPs for SQL Server 2014. As the paper got longer with each release, a new white paper for the final released product would be as long as a book. So, with Kevin's encouragement, it became the first edition of this book. For the SQL Server 2016 version of in-memory OLTP, Marko Hotti brought me onboard to write two white papers, including one for the final version of SQL Server 2016. This book expands upon that second white paper. xiv
  • 18. My main mentors for this second edition, based on the changes in SQL Server 2016, were Sunil Agarwal and Jos de Bruijn. I know they thought my questions would never stop, but they kept answering them anyway. I am deeply indebted to both of them. I would also like to thank my devoted reviewers and question answerers at Microsoft, without whom this work would have taken much longer: in addition to Sunil and Jos, Kevin Farlee was always willing and able to answer in-depth questions about storage, and Denzil Ribeiro and Alex Budovski were always quick to respond and were very thorough in answering my sometimes seemingly-endless questions. Thank you for all your assistance and support. And THANK YOU to the entire SQL Server team at Microsoft for giving us this incredible technology! About the Technical Reviewer Benjamin Nevarez is a database professional based in Los Angeles, California who special- izes in SQL Server query tuning and optimization. He is the author of three books, High Performance SQL Server, SQL Server 2014 Query Tuning & Optimization and Inside the SQL Server Query Optimizer, and has also coauthored other books including SQL Server 2012 Internals. Benjamin has also been a speaker at many SQL Server conferences and events around the world including the PASS Summit, SQL Server Connections and SQLBits. His blog can be found at http://www.benjaminnevarez.com and he can also be reached on Twitter at @BenjaminNevarez. xv
  • 19. Introduction The original design of the SQL Server engine, as well as that of most other RDBMS products of the time, assumed that main memory was very limited, and so data needed to reside on disk except when it was actually needed for processing. However, over the past thirty years, the sustained fulfillment of Moore's Law, predicting that computing power will double year on year, has rendered this assumption largely invalid. Moore's law has had a dramatic impact on the availability and affordability of both large amounts of memory and multiple-core processing power. Today one can buy a server with 32 cores and 1 TB of memory for under $30K. Looking further ahead, it's entirely possible that in a few years we'll be able to build distributed DRAM-based systems with capacities of 1–10 Petabytes at a cost of less than $5/GB. It is also only a question of time before non- volatile RAM becomes viable as main-memory storage. At the same time, the near-ubiquity of 64-bit architectures removes the previous 4 GB limit on "addressable" memory and means that SQL Server has, in theory, near-limitless amounts of memory at its disposal. This has helped to significantly drive down latency time for read operations, simply because we can fit so much more data in memory. For example, many, if not most, of the OLTP databases in production can fit entirely in 1 TB. Even for the largest financial, online retail and airline reservation systems, with databases between 500 GB and 5 TB in size, the performance-sensitive working dataset, i.e. the "hot" data pages, is signifi- cantly smaller and could reside entirely in memory. However, the fact remains that the traditional SQL Server engine is optimized for disk- based storage, for reading specific 8 KB data pages into memory for processing, and writing specific 8 KB data pages back out to disk after data modification, having first "hardened" the changes to disk in the transaction log. Reading and writing 8 KB data pages from and to disk can generate a lot of random I/O and incurs a higher latency cost. In fact, given the amount of data we can fit in memory, and the high number of cores avail- able to process it, the end result has been that most current SQL Server systems are I/O bound. In other words, the I/O subsystem struggles to "keep up," and many organizations sink huge sums of money into the hardware that they hope will improve write latency. Even when the data is in the buffer cache, SQL Server is architected to assume that it is not, which leads to inefficient CPU usage, with latching and spinlocks. 16
  • 20. Assuming all, or most, of the data will need to be read from disk also leads to unrealistic cost estimations for the possible query plans and a potential for not being able to determine which plans will really perform best. As a result of these trends, and the limitations of traditional disk-based storage structures, the SQL Server team at Microsoft began building a database engine optimized for large main memories and many-core CPUs, driven by the recognition that systems designed for a partic- ular class of workload can frequently outperform more general purpose systems by a factor of ten or more. Most specialized systems, including those for Complex Event Processing (CEP), Data Warehousing and Business Intelligence (DW/BI), and Online Transaction Processing (OLTP), optimize data structures and algorithms by focusing on in-memory structures. The team set about building a specialized database engine specifically for in-memory work- loads, which could be tuned just for those workloads. The original concept was proposed at the end of 2008, envisioning a relational database engine that was 100 times faster than the existing SQL Server engine. In fact, the codename for this feature, Hekaton, comes from the Greek word hekaton (ἑκατόν) meaning 100. Serious planning and design began in 2010, and product development began in 2011. At that time, the team did not know whether the current SQL Server product could support this new concept, and the original vision was that it might be a separate product. Fortunately, it soon became evident that it would be possible to incorporate the "in-memory" processing engine into SQL Server itself. The team then established four main goals as the foundation for further design and planning: 1. Optimized for data that was stored completely in-memory but was also durable on SQL Server restarts. 2. Fully integrated into the existing SQL Server engine. 3. Very high performance for OLTP operations. 4. Architected for modern CPUs (e.g. use of complex atomic instructions). SQL Server In-Memory OLTP, formerly known and loved as Hekaton, meets all of these goals, and in this book, you will learn how it meets them. The focus will be on the features that allow high performance for OLTP operations. As well as eliminating read latency, since the data will always be in memory, fundamental changes to the memory-optimized versions of tables and indexes, as well as changes to the logging mechanism, mean that in-memory OLTP also offers greatly reduced latency when writing to disk. 17
  • 21. The first four chapters of the book offer a basic overview of how the technology works (Chapter 1), how to create in-memory databases and tables (Chapter 2), the basics of row versioning and the new multi-version concurrency control model (Chapter 3), how memory- optimized tables and their indexes store data, and how columnstore indexes, available for memory-optimized tables as of SQL Server 2016, allow you to perform efficient OLTP operations, as well as run analytic queries, on your in-memory data (Chapter 4). Chapters in the latter half of the book focus on how the new in-memory engine delivers the required performance boost, while still ensuring transactional consistency (ACID compli- ance). In order to deliver on performance, the SQL Server team realized they had to address some significant performance bottlenecks. Two major bottlenecks were the traditional locking and latching mechanisms: if the new in-memory OTLP engine retained these mecha- nisms, with the waiting and possible blocking that they could cause, it could negate much of the benefit inherent in the vastly increased speed of in-memory processing. Instead, SQL Server In-Memory OLTP delivers a completely lock- and latch-free system, and true opti- mistic multi-version concurrency control (Chapter 5). Other potential bottlenecks were the existing CHECKPOINT and transaction logging processes. The need to write to durable storage still exists for in-memory tables, but in SQL Server In-Memory OLTP these processes are adapted to be much more efficient, in order to prevent them becoming performance limiting, especially given the potential to support vastly increased workloads (Chapter 6). The final bottleneck derives from the fact that the SQL Server query processor is essentially an interpreter; it re-processes statements continually, at runtime. It is not a true compiler. Of course, this is not a major performance concern, when the cost of physically reading data pages into memory from disk dwarfs the cost of query interpretation. However, once there is no cost of reading pages, the difference in efficiency between interpreting queries and running compiled queries can be enormous. Consequently, the new SQL Server In-Memory OLTP engine component provides the ability to create natively compiled procedures, i.e. machine code, for our most commonly executed data processing operations (Chapter 7). Finally, we turn our attention to tools for managing SQL Server In-Memory OLTP structures, for monitoring and tuning performance, and considerations for migrating existing OLTP workloads over to in-memory (Chapter 8). 18
  • 22. Intended Audience and Prerequisites This book is for anyone using SQL Server as a programmer or as an administrator who wants to understand how the new Hekaton engine works behind the scenes. It is specifically a book about Hekaton internals, focusing on details of memory-optimized tables and indexes, how the in-memory engine delivers transactional consistency (ACID compliance) without locking or latching, and the mechanics of its checkpointing, logging and garbage collection mechanisms. SQL Server In-Memory OLTP is a new technology and this is not a book specifically on performance tuning and best practices. However, as you learn about how the Hekaton engine works internally to process your queries, certain best practices, and opportunities for perfor- mance tuning will become obvious. This book does not assume that you're a SQL Server expert, but I do expect that you have basic technical competency and familiarity with the standard SQL Server engine, and relative fluency with basic SQL statements. You should have access to a SQL Server 2016 installation, even if it is the Evaluation edition available free from Microsoft. In addition, SQL Server Developer Edition, which doesn't have an expiration date, is also available free of charge. Downloads are available from this link: http://preview.tinyurl.com/lea3ep8. As of SQL Server 2016, Service Pack 1, in-memory OLTP is available in all editions of SQL Server. The Hands-On Exercises This book will provide the reader with scripts for hands-on exercises, shown as listings, to create memory-optimized databases, tables and indexes and to explore some aspects of Hekaton behavior. My examples were all created using SQL Server Management Studio (SSMS). You can download these scripts from: http://preview.tinyurl.com/y72g47te. All examples have been verified on SQL Server 2016 SP1 (13.0.4001.0). All of the examples use custom-built sample databases, as defined in the text and scripts. The only exception is Listing 2-2 which shows you how to enable an existing database to use memory-optimized tables; it uses AdventureWorks2014, but you could easily edit the script to substitute any existing database. 19
  • 23. 1: What's Special About In-Memory OLTP? SQL Server 2016's in-memory OLTP feature provides a suite of technologies for working with memory-optimized tables, in addition to the disk-based tables which SQL Server has always provided. The SQL Server team designed the in-memory OLTP engine to be transparently accessible through familiar interfaces such as T-SQL and SQL Server Management Studio (SSMS). Therefore, during most data processing operations, users may be unaware that they are working with memory-optimized tables rather than disk-based ones. However, SQL Server works with the data very differently if it is stored in memory-opti- mized tables. This chapter describes, at a high level, some of the fundamental differences between data storage structures and data operations, when working with memory-optimized, rather than standard disk-based tables and indexes. It will also discuss SQL Server In-Memory OLTP in the context of similar, competing memory-optimized database solutions, and explain why the former is different. Isn't In-Memory OLTP Just an Improved DBCC PINTABLE? Let's dispel this myth right at the start: SQL Server In-Memory OLTP bears no relation or similarities at all to DBCC PINTABLE, a feature available in older versions of SQL Server that would not remove any data pages from a "pinned" table from memory, once those pages were read from disk. These pinned tables were no different than any other disk-based tables. They required the same amount of locking, latching, and logging and they used the same index structures, which also required locking and logging. By contrast, as we'll discuss through this and subsequent chapters, the memory-optimized tables in SQL Server In-Memory OLTP are completely different than SQL Server disk-based tables. They use different data and index structures, and SQL Server takes no locks or latches 20
  • 24. on these structures during reading or writing, so it can allow concurrent access without blocking. Also, logging changes to memory-optimized tables is usually much more efficient than logging changes to disk-based tables. The In-Memory OLTP Component In-memory OLTP is integrated with the SQL Server relational engine, allowing us to access in-memory data using standard interfaces such as T-SQL and SSMS, transparently. However, its internal behavior and capabilities are very different than those of the standard relational engine. In addition, in-memory OLTP allows an entirely new, highly efficient access path, using natively compiled stored procedures. Figure 1-1 gives an overview of the SQL Server engine with the in-memory OLTP components. Figure 1-1: The SQL Server engine including the in-memory OLTP components. 21 1: What's Special About In-Memory OLTP?
  • 25. On the left side of Figure 1-1 we have the memory-optimized tables and indexes, added as part of in-memory OLTP, and on the right we see the disk-based tables, which use the data structures that SQL Server has always used, and which require writing and reading 8 KB data pages, as a unit, to and from disk. In-memory OLTP also supports natively compiled stored procedures, an object type that is compiled to machine code by a new in-memory OLTP compiler and which has the potential to offer a further performance boost beyond that available solely from the use of memory- optimized tables. The standard counterpart is interpreted T-SQL stored procedures, which is what SQL Server has always used. Natively compiled stored procedures can reference only memory-optimized tables. The Query Interop component allows interpreted T-SQL to reference memory-optimized tables. If a transaction can reference both memory-optimized tables and disk-based tables, we refer to it as a cross-container transaction. Notice that the client application uses the same TDS Handler (Tabular Data Stream, the underlying networking protocol that is used to communicate with SQL Server), regardless of whether it is accessing memory-optimized tables or disk-based tables, or calling natively compiled stored procedures or interpreted T-SQL. Memory-optimized tables This section takes a broad look at three of the key differences between memory-optimized tables and their disk-based counterparts; subsequent chapters will fill in the details. Entirely in-memory storage When accessing disk-based tables, the data we need will hopefully be resident in memory, although it may not be. If not, the engine needs to read from disk the required data pages. This basic assumption that the data pages reside on disk underpins all data operations against disk-based tables, with user processes acquiring locks to protect data pages in the buffer cache from the effects of concurrent transactions, and SQL Server acquiring latches on pages as it reads them from, and writes them to, disk. The first and perhaps most fundamental difference when using memory-optimized tables is that the whole table and its indexes are stored in memory all the time. Therefore, when accessing in-memory data structures, user processes will always find the required data in-memory. Concurrent data operations require no locking or latching whatsoever, thanks to a new, truly optimistic concurrency model, which we'll get to shortly. 22 1: What's Special About In-Memory OLTP?
  • 26. As user processes modify in-memory data, SQL Server still needs to perform some disk I/O for any table that we wish to be durable, in other words where we wish a table to retain the in-memory data in the event of a server crash or restart. We'll return to this a little later in this chapter, in the Data durability and recovery section. Row-based storage structure The second big difference between disk-based tables and memory-optimized tables is in their underlying storage structure. The former is optimized for block-addressable disk storage, whereas the latter is optimized for byte-addressable memory storage. For disk-based tables, SQL Server organizes data rows into 8 KB units called data pages, with space allocated from extents (eight contiguous pages), on disk. The data page is the basic unit of storage on disk and in memory. When SQL Server reads and writes data from disk, it reads and writes the relevant data pages. A data page will only contain data from one table or index. User processes modify rows on various data pages as required, and later, during a CHECK- POINT process, SQL Server first hardens the log records to disk and then writes all dirty pages to disk, the latter operation often causing a lot of "random" physical I/O. For memory-optimized tables, there are no data pages, and no extents; there are just "data rows," written to memory sequentially, in the order the transactions occurred, with each row containing an index "pointer" to the next row. All "I/O" is then in-memory scanning of these structures. It means there is no notion of data rows being written to a particular location that "belongs" to a specified object. However, this is not to imply that memory-optimized tables are stored as unorganized sets of data rows, like a disk-based heap. In fact, every CREATE TABLE statement for a memory-optimized table must also create at least one index that SQL Server can use to link together all the data rows for that table (see the later section on Indexes on memory-optimized tables). Each data row consists of two areas, the row header and then the payload, which is the actual column data. We'll discuss this structure in much more detail in Chapter 3, but the information stored in the row header includes the identity of the statement that created the row, pointers for each index on the target table and, critically, some timestamp values. There will be a timestamp recording the time a transaction inserted a row, and another indicating the time a transaction deleted a row. SQL Server records updates by inserting a new version of the row and marking the old version as "deleted." The actual cleanup of row versions that are no longer required, which involves unlinking them from index structures and removing them from memory, is a cooperative process involving both user threads and a dedicated garbage collection thread (more on this in Chapter 5). 23 1: What's Special About In-Memory OLTP?
  • 27. As this implies, many versions of the same row can coexist at any given time. This allows concurrent access of the same row, during data modifications, with SQL Server displaying the row version relevant to each transaction according to the time the transaction started relative to the timestamps of the row version. This is the essence of the new multi-version concur- rency control (MVCC) mechanism for in-memory tables, which I'll describe in a little more detail later in the chapter. Native compilation of tables The final significant difference between disk-based and memory-optimized tables is that the latter are natively compiled. When we create a memory-optimized table or index, SQL Server describes the structure of the table and its indexes in the metadata for the table. It then uses this metadata to compile into a DLL (Dynamic Link Library) a set of native language routines (from an intermediate, auto-generated C language step) just for accessing that table. These DLLs are associated with the database, but not actually part of it. In other words, SQL Server holds in memory, not only the table and index structures, but also a set of DLLs for accessing and modifying these data structures. The table metadata encodes into each DLL a set of native language algorithms that describe precisely the row format for the table and how to traverse its indexes, thus providing highly efficient access paths for the table data. This explains why we cannot technically alter a table, once created; if the table were altered, SQL Server would have to regenerate all the DLLs for table operations. Although SQL Server 2016 does allow the use of the ALTER TABLE command for memory- optimized tables, behind the scenes SQL Server is actually dropping and recreating the table, and thus all the DLLs for table operations are regenerated. These DLLs result in much faster data access than is possible via the traditional way of using interpreted metadata. A big success of the implementation of in-memory OLTP is to have made these operations "invisible" to the user. Natively compiled stored procedures The best execution performance is obtained when using natively compiled stored procedures to access memory-optimized tables, which are also natively compiled, as described above. Natively compiled stored procedures consist of processor instructions that can be executed directly by the CPU, without the need for further compilation or interpretation. Also, a natively compiled procedure will generate far fewer CPU instructions for the engine to execute than the equivalent interpreted T-SQL stored procedure. 24 1: What's Special About In-Memory OLTP?
  • 28. However, there are limitations on the T-SQL language constructs that are allowed inside a natively compiled stored procedure, compared to the rich feature set available with inter- preted code. In addition, natively compiled stored procedures can only access memory-opti- mized tables and cannot reference disk-based tables. Chapter 7 discusses natively compiled stored modules in detail. Concurrency improvements: the MVCC model SQL Server's traditional pessimistic concurrency control mechanisms, when accessing disk- based tables, use locks and latches to prevent "interference" between concurrent transac- tions on the same data rows, and so preserve the ACID characteristics of each transaction. Processes that read data take shared locks on a resource to prevent processes writing data from modifying that data until the reading statement (or transaction, depending on the trans- action isolation level) commits or rolls back. Writers take exclusive locks to prevent other readers and writers from accessing "in-transit" data. In other words, transactions often have to pause processing while they wait to acquire locks (or latches) on a resource. SQL Server 2005 introduced a "sort of" optimistic version of concurrency control, using the snapshot-based isolation levels, and maintaining previous row versions in a tempdb version store. Under this model, readers no longer acquire shared locks. Instead of blocking, when one transaction needs to read rows that another transaction is modifying, the reader retrieves, from the version store, the previously committed values of the set of rows it needs. There- fore, SQL Server can preserve the ACID properties without having readers block writers, and without writers blocking readers. However, SQL Server still acquires locks during data modifications and so writers still block other writers. In contrast, SQL Server In-Memory OLTP introduces a truly optimistic MVCC model. It uses row versioning but its implementation bears little relation to the snapshot-based model used for disk-based tables. When accessing memory-optimized tables and index structures, SQL Server still supports the ACID properties of transactions, but it does so without ever using locking or latching to provide transaction isolation. The tempdb database is not used for any storage. This means that no transaction ever has, for lock-related reasons, to wait to read or modify a data row. Readers never block writers, writers never block readers, and writers never block writers. Chapter 5 provides further details on concurrency management with memory-optimized tables. 25 1: What's Special About In-Memory OLTP?
  • 29. Indexes on memory-optimized tables Indexes perform the same purpose for memory-optimized tables as their disk-based counter- parts. However, again, under the covers they are very different structures. With disk-based storage structures, there are data pages that combine sets of rows into a single structure. With in-memory structures, there are no such pages and instead SQL Server uses indexes to combine all the rows that belong to a table into a single structure. Every memory-optimized table must have at least one index. In general, we create indexes as part of table creation; unlike for disk-based indexes, we cannot use CREATE INDEX to create memory-optimized indexes. As of SQL Server 2016, we can use ALTER TABLE to add a new index to a memory-optimized table. If we create a PRIMARY KEY on a column, and durable memory-optimized tables must have a PRIMARY KEY, then SQL Server automatically creates a unique index on that column. Like tables, SQL Server memory-optimized indexes are always entirely memory resident. However, unlike for tables, SQL Server never logs operations on indexes. Except for column- store indexes, which as of SQL Server 2016 can be created on memory-optimized tables, SQL Server never persists indexes on memory-optimized tables to the on-disk checkpoint files (covered shortly). SQL Server maintains indexes automatically during all modification operations on memory-optimized tables, just like B-tree indexes on disk-based tables, but in case of a restart, SQL Server rebuilds the indexes on the memory-optimized tables as the data is streamed into memory. Again, the exception is columnstore indexes on memory-optimized tables, which don't have to be completely rebuilt on SQL Server restart. In addition to the afore-mentioned columnstore indexes, memory-optimized tables support two basic types of indexes, both of which are nonclustered structures: hash indexes and range indexes. A hash index is a special type of SQL Server index, specifically for memory-optimized tables, which is useful for performing lookups on specific values. A hash index is stored as a hash table, and is essentially an array of hash buckets, where each bucket points to the loca- tion in memory of a data row. SQL Server applies a hash function to the index key values, and maps each one to the appropriate bucket. In each bucket is a pointer to a single row, the first row in the list of rows that hash to the same value. From that row, all other rows in the hash bucket are joined in a singularly-linked list (this will become clearer when we get to see some diagrams in Chapter 4). 26 1: What's Special About In-Memory OLTP?
  • 30. A nonclustered range index, useful for retrieving ranges of values, is more like the sort of index we're familiar with when working with disk-based tables. However, again, the structure is different. The memory-optimized counterparts use a special Bw-tree storage structure. A Bw-tree is similar to a disk-based B-tree index in that it has index pages organized into a root page, a leaf level, and possibly intermediate-level pages. However, the pages of a Bw-tree are very different structures from their disk-based counterparts. The pages can be of varying sizes, and the pages themselves are never modified; new pages are created when necessary, when the underlying rows are modified. Columnstore indexes, which were added to the product in SQL Server 2012, are available with memory-optimized tables starting in SQL Server 2016. These indexes allow you to perform analytics, efficiently, on the data that is stored in memory. As the name "in-memory OLTP" implies, memory-optimized tables are optimized for transaction processing, but by adding columnstore indexes, we can also get good performance with analytical operations, such as reports which need to process and summarize all the rows in the table. Columnstore indexes are described in detail in Chapter 4. Data durability and recovery For memory-optimized data structures, both tables and indexes, all the data is stored in memory, all the time. However, to continue to ensure the durability of the data, SQL Server logs operations on memory-optimized tables (not indexes) to the same transaction log that is used to log operations on disk-based tables and, as always, the transaction log is stored on disk. Efficient logging for in-memory data We'll discuss this topic in much more detail in Chapter 6, but logging for in-memory tables is more efficient than for disk-based tables essentially because, given the same workload, SQL Server will write far fewer log records for an in-memory table than for its equivalent disk- based table. For example, it doesn't log any changes to data in indexes. It will also never write log records associated with uncommitted transactions, since SQL Server will never write dirty data to disk for in-memory tables. Also, rather than write every atomic change as a single log record, in-memory OLTP will combine many changes into a single log record. SQL Server In-Memory OLTP also continuously persists the table data to disk in special checkpoint files. It uses these files only for database recovery, and only ever writes to them "offline," using a background thread. Therefore, when we create a database that will use 27 1: What's Special About In-Memory OLTP?
  • 31. memory-optimized data structures, we must create, not only the data file (used only for disk- based table storage) and the log file, but also a special MEMORY_OPTIMIZED_DATA file- group that will contain the checkpoint files. There are four types of checkpoint files: DATA files and DELTA files exist as pairs, and so are frequently referred to as checkpoint file pairs. In SQL Server 2016, we also have ROOT files and LARGE DATA files. We'll see more on these checkpoint files in Chapter 6. These checkpoint files are append-only and SQL Server writes to them strictly sequentially, in the order of the transactions in the transaction log, to minimize the I/O cost. In case of a system crash or server shutdown, SQL Server can recreate the rows of data in the memory- optimized tables from the checkpoint files and the transaction log. When we insert a data row into a memory-optimized table, the background thread (called the offline checkpoint thread) will, at some point, append the inserted row to the corresponding DATA checkpoint file. Likewise, when we delete a row, the thread will append a reference to the deleted row to the corresponding DELTA checkpoint file. So, a "deleted" row remains in the DATA file but the corresponding DELTA file records the fact that it was deleted. As the checkpoint files grow, SQL Server will at some point merge them, so that rows marked as deleted actually get deleted from the DATA checkpoint file, and create a new file pair. Again, further details of how all this works, as well as details about the other types of checkpoint files, can be found in Chapter 6. In-memory OLTP does provide the option to create a table that is non-durable, using an option called SCHEMA_ONLY. As the option indicates, SQL Server will log the table creation, so the table schema will be durable, but will not log any data manipulation language (DML) on the table, so the data will not be durable. These tables do not require any I/O operations during transaction processing, but the data is only available in memory while SQL Server is running. These non-durable tables could be useful in certain cases, for example as staging tables in ETL scenarios or for storing web server session state. In the event of a SQL Server shutdown, or an AlwaysOn Availability Group fail-over, the data in these non-durable tables is lost. When SQL Server runs recovery on the database, it will recreate the tables but without the data. Although the data is not durable, operations on these tables meet all the other transactional requirements; they are atomic, isolated, and consistent. We'll see how to create both durable and non-durable tables in Chapter 2. 28 1: What's Special About In-Memory OLTP?
  • 32. Performance The special data structures for rows and indexes, the elimination of locks and latches, and the ability to create natively compiled stored procedures and functions, all allow for incredible performance when working with memory-optimized tables. In the Microsoft lab, one partic- ular customer achieved 1 million batch requests/sec, with 4 KB of data read and written with each batch, without maxing out the CPU. Although that workload used SCHEMA_ONLY tables, durable (SCHEMA_AND_DATA) tables can also get impressive results. Lab results repeatedly showed a sustained ingestion of 10M rows/second, with an average of 100 bytes per row. A representative order processing work- load showed 260 K transactions per second, with 1 GB/sec of log generation. Both the SCHEMA_ONLY and SCHEMA_AND_DATA tables were created on 4-socket servers with a total of 72 physical cores. SQL Server 2014 was consistently showing in-memory OLTP applications achieving a 30–40x improvement, measured mainly with batch requests processed per second. In SQL Server 2016, the visionary improvement of a 100-fold increase has been achieved by one of the earliest adopters of SQL Server In-Memory OLTP. A process running on SQL Server 2012 had measured overall throughput of 12,000 batch requests per second, with the main bottleneck being latch contention. The same process running on SQL Server 2016, taking advantage of memory-optimized tables with large object (LOB) support, and natively compiled procedures, showed 1.2 million batch requests per second. The bottleneck in that case was CPU. The designers of the in-memory OLTP technology in SQL Server were so sure of the performance gains that would be realized, that the component name "xtp," which stands for "eXtreme Transaction Processing," is used in most of the Hekaton metadata object names. 29 1: What's Special About In-Memory OLTP?
  • 33. Discovering Diverse Content Through Random Scribd Documents
  • 34. soon after," is a not infrequent phrase. It is manifestly impossible to investigate these cases now, and to verify the facts, but the well- tested honesty of the early Friends leaves little ground for doubting that the facts were substantially as they are reported. Fox's own inference that all these persons had misfortune as a direct "judgment" for having harmed him and hindered his cause will naturally seem to us a too hasty conclusion. It is not at all strange that in this eventful period many persons who had dealings with him should have suffered swift changes of fortune, and of course he failed to note how many there were who did not receive judgment in this direct manner. One regrets, of course, that this kindly spiritual man should have come so near enjoying what seemed to him a divine vengeance upon his enemies, but we must remember that he believed in his soul that his work was God's work, and hence to frustrate it was serious business. He founded a Society, as he called it, which he evidently hoped, and probably believed, would sometime become universal.[E] The organization in every aspect recognized the fundamentally spiritual nature of man. Every individual was to be a vital, organic part of the whole; free, but possessed of a freedom which had always to be exercised with a view to the interests and edification of the whole. It was modelled exactly on the conception of Paul's universal Church of many members, made a unity not from without, but by the living presence of the One Spirit. All this work of organization was effected while Fox himself was in the saddle, carrying his message to town after town, interrupted by long absences in jail and dungeon, and steadily opposed by the fanatical antinomian elements which had flocked to his standard. It is not the least mark of his genius that in the face of an almost unparalleled persecution he left his fifty thousand followers in Great Britain and Ireland formed into a working and growing body, with equally well-organized meetings in Holland, New England, New York, Pennsylvania, Maryland, Virginia and the Carolinas. His personality and his message had won men from every station of life, and if the rank and file were from the humbler walks, there were also men and women of scholarship and
  • 35. fame. Robert Barclay, from the schools of Paris, gave the new faith its permanent expression in his Apology. William Penn worked its principles out in a holy experiment in a Christian Commonwealth, and Isaac Penington, in his brief essays, set forth in rich and varied phrase the mystical truth which was at the heart of the doctrine. This is the place for exposition, not for criticism. It requires no searchlight to reveal in this man the limitations and imperfections which his age and his own personal peculiarities fixed upon him. He saw in part and he prophesied in part. But, like his great contemporary, Cromwell, he had a brave sincerity, a soul absolutely loyal to the highest he saw. The testimony of the Scarborough jailer is as true as it is unstudied—"as stiff as a tree and as pure as a bell." It is fitting that this study of him should close with the words of the man who knew him best—William Penn: "I write my knowledge and not report, and my witness is true, having been with him for weeks and months together on diverse occasions, and those of the nearest and most exercising nature, by sea and land, in this country and in foreign countries; and I can say I never saw him out of his place, or not a match for every service or occasion. For in all things he acquitted himself like a man, yea, a strong man, a new and heavenly-minded man; a divine and a naturalist, and all of God Almighty's making."[F]
  • 36. THE TESTIMONY OF WILLIAM PENN CONCERNING THAT FAITHFUL SERVANT
  • 37. GEORGE FOX. The blessed instrument of and in this day of God, and of whom I am now about to write, was George Fox, distinguished from another of that name, by that other's addition of younger to his name in all his writings; not that he was so in years, but that he was so in the truth; but he was also a worthy man, witness and servant of God in his time. But this George Fox was born in Leicestershire, about the year 1624. He descended of honest and sufficient parents, who endeavoured to bring him up, as they did the rest of their children, in the way and worship of the nation; especially his mother, who was a woman accomplished above most of her degree in the place where she lived. But from a child he appeared of another frame of mind than the rest of his brethren; being more religious, inward, still, solid, and observing, beyond his years, as the answers he would give, and the questions he would put upon occasion manifested, to the astonishment of those that heard him, especially in divine things. His mother taking notice of his singular temper, and the gravity, wisdom, and piety that very early shone through him, refusing childish and vain sports and company when very young, she was tender and indulgent over him, so that from her he met with little difficulty. As to his employment, he was brought up in country business; and as he took most delight in sheep, so he was very skilful in them; an employment that very well suited his mind in several respects, both for its innocency and solitude; and was a just figure of his after ministry and service. I shall not break in upon his own account, which is by much the best that can be given; and therefore desire, what I can, to avoid saying anything of what is said already, as to the particular passages of his coming forth; but, in general, when he was somewhat above twenty,
  • 38. he left his friends, and visited the most retired and religious people, and some there were at that time in this nation, especially in those parts, who waited for the consolation of Israel night and day, as Zacharias, Anna, and good old Simeon did of old time. To these he was sent, and these he sought out in the neighboring countries, and among them he sojourned till his more ample ministry came upon him. At this time he taught and was an example of silence, endeavouring to bring people from self-performances, testifying and turning to the light of Christ within them, and encouraging them to wait in patience to feel the power of it to stir in their hearts, that their knowledge and worship of God might stand in the power of an endless life, which was to be found in the light, as it was obeyed in the manifestation of it in man. "For in the Word was life, and that life was the light of men." Life in the Word, light in men, and life too, as the light is obeyed; the children of the light living by the life of the Word, by which the Word begets them again to God, which is the regeneration and new birth, without which there is no coming unto the kingdom of God; and which, whoever comes to, is greater than John, that is, than John's ministry, which was not that of the kingdom, but the consummation of the legal, and opening of the gospel-dispensation. Accordingly, several meetings were gathered in those parts; and thus his time was employed for some years. In 1652, he being in his usual retirement to the Lord upon a very high mountain, in some of the hither parts of Yorkshire, as I take it, his mind exercised towards the Lord, he had a vision of the great work of God in the earth, and of the way that he was to go forth to begin it. He saw people as thick as motes in the sun, that should in time be brought home to the Lord, that there might be but one Shepherd and one sheepfold in all the earth. There his eye was directed northward, beholding a great people that should receive him and his message in those parts. Upon this mountain he was moved of the Lord to sound out his great and notable day, as if he had been in a great auditory, and from thence went north, as the Lord had shewn him: and in every place where he came, if not
  • 39. before he came to it, he had his particular exercise and service shewn to him, so that the Lord was his leader indeed; for it was not in vain that he travelled, God in most places sealing his commission with the convincement of some of all sorts, as well publicans as sober professors of religion. Some of the first and most eminent of them, which are at rest, were Richard Farnsworth, James Nayler, William Dewsberry, Francis Howgil, Edward Burrough, John Camm, John Audland, Richard Hubberthorn, T. Taylor, John Aldam, T. Holmes, Alexander Parker, William Simpson, William Caton, John Stubbs, Robert Widders, John Burnyeat, Robert Lodge, Thomas Salthouse, and many more worthies, that cannot be well here named, together with divers yet living of the first and great convincement, who after the knowledge of God's purging judgments in themselves, and some time of waiting in silence upon him, to feel and receive power from on high to speak in his name (which none else rightly can, though they may use the same words), felt the divine motions, and were frequently drawn forth, especially to visit the publick assemblies, to reprove, inform and exhort them, sometimes in markets, fairs, streets, and by the highway side, calling people to repentance, and to turn to the Lord with their hearts as well as their mouths; directing them to the light of Christ within them, to see and examine and consider their ways by, and to eschew the evil and do the good and acceptable will of God. And they suffered great hardships for this their love and good-will, being often stocked, stoned, beaten, whipped and imprisoned, though honest men and of good report where they lived, that had left wives and children, and houses and lands, to visit them with a living call to repentance. And though the priests generally set themselves to oppose them, and write against them, and insinuated most false and scandalous stories to defame them, stirring up the magistrates to suppress them, especially in those northern parts, yet God was pleased so to fill them with his living power, and give them such an open door of utterance in his service, that there was a mighty convincement over those parts.
  • 40. And through the tender and singular indulgence of Judge Bradshaw and Judge Fell, in the infancy of things, the priests were never able to gain the point they laboured for, which was to have proceeded to blood, and if possible, Herod-like, by a cruel exercise of the civil power, to have cut them off and rooted them out of the country. Especially Judge Fell, who was not only a check to their rage in the course of legal proceedings, but otherwise upon occasion, and finally countenanced this people; for his wife receiving the truth with the first, it had that influence upon his spirit, being a just and wise man, and seeing in his own wife and family a full confutation of all the popular clamours against the way of truth, that he covered them what he could, and freely opened his doors, and gave up his house to his wife and her friends, not valuing the reproach of ignorant or evil-minded people, which I here mention to his and her honour, and which will be I believe an honour and a blessing to such of their name and family as shall be found in that tenderness, humility, love and zeal for the truth and people of the Lord. That house was for some years at first, till the truth had opened its way in the southern parts of this island, an eminent receptacle of this people. Others of good note and substance in those northern countries had also opened their houses with their hearts to the many publishers, that in a short time the Lord had raised to declare his salvation to the people, and where meetings of the Lord's messengers were frequently held, to communicate their services and exercises, and comfort and edify one another in their blessed ministry. But lest this may be thought a digression, having touched upon this before, I return to this excellent man: and for his personal qualities, both natural, moral, and divine, as they appeared in his converse with his brethren and in the church of God, take as follows. I. He was a man that God endowed with a clear and wonderful depth, a discerner of others' spirits, and very much a master of his own. And though the side of his understanding which lay next to the world, and especially the expression of it, might sound uncouth and
  • 41. unfashionable to nice ears, his matter was nevertheless very profound, and would not only bear to be often considered, but the more it was so, the more weighty and instructing it appeared. And as abruptly and brokenly as sometimes his sentences would fall from him about divine things, it is well known they were often as texts to many fairer declarations. And indeed it shewed beyond all contradiction that God sent him, that no arts or parts had any share in the matter or manner of his ministry, and that so many great, excellent, and necessary truths as he came forth to preach to mankind, had therefore nothing of man's wit or wisdom to recommend them. So that as to man he was an original, being no man's copy. And his ministry and writings shew they are from one that was not taught of man, nor had learned what he said by study. Nor were they notional or speculative, but sensible and practical truths, tending to conversion and regeneration, and the setting up the kingdom of God in the hearts of men, and the way of it was his work. So that I have many times been overcome in myself, and been made to say with my Lord and Master upon the like occasion, "I thank thee, O Father, Lord of heaven and earth, that thou hast hid these things from the wise and prudent of this world, and revealed them to babes"; for many times hath my soul bowed in an humble thankfulness to the Lord, that he did not choose any of the wise and learned of this world to be the first messenger in our age of his blessed truth to men; but that he took one that was not of high degree, or elegant speech, or learned after the way of this world, that his message and work He sent him to do might come with less suspicion or jealousy of human wisdom and interest, and with more force and clearness upon the consciences of those that sincerely sought the way of truth in the love of it. I say, beholding with the eye of my mind, which the God of heaven had opened in me, the marks of God's finger and hand visibly in this testimony from the clearness of the principle, the power and efficacy of it in the exemplary sobriety, plainness, zeal, steadiness, humility, gravity, punctuality, charity, and circumspect care in the government of church affairs, which shined in his and their life and testimony that God employed in this work, it greatly confirmed me that it was of
  • 42. God, and engaged my soul in a deep love, fear, reverence, and thankfulness for his love and mercy therein to mankind; in which mind I remain, and shall, I hope, to the end of my days. II. In his testimony or ministry he much laboured to open truth to the people's understandings, and to bottom them upon the principle and principal, Christ Jesus, the light of the world, that by bringing them to something that was of God in themselves, they might the better know and judge of him and themselves. He had an extraordinary gift in opening the Scriptures. He would go to the marrow of things, and shew the mind, harmony, and fulfilling of them with much plainness, and to great comfort and edification. The mystery of the first and second Adam, of the fall and restoration, of the law and gospel, of shadows and substance, of the servant and son's state, and the fulfilling of the Scriptures in Christ, and by Christ the true light, in all that are His, through the obedience of faith, were much of the substance and drift of his testimonies. In all which he was witnessed to be of God, being sensibly felt to speak that which he had received of Christ, and was his own experience in that which never errs nor fails. But above all he excelled in prayer. The inwardness and weight of his spirit, the reverence and solemnity of his address and behaviour, and the fewness and fullness of his words, have often struck even strangers with admiration, as they used to reach others with consolation. The most awful, living, reverent frame I ever felt or beheld, I must say, was his in prayer. And truly it was a testimony he knew, and lived nearer to the Lord than other men; for they that know him most will see most reason to approach him with reverence and fear. He was of an innocent life, no busy-body, nor self-seeker, neither touchy nor critical: what fell from him was very inoffensive, if not very edifying. So meek, contented, modest, easy, steady, tender, it was a pleasure to be in his company. He exercised no authority but over evil, and that everywhere and in all; but with love, compassion,
  • 43. and long-suffering. A most merciful man, as ready to forgive as unapt to take or give offence. Thousands can truly say, he was of an excellent spirit and savour among them, and because thereof the most excellent spirits loved him with an unfeigned and unfading love. He was an incessant labourer; for in his younger time, before his many great and deep sufferings and travels had enfeebled his body for itinerant services, he laboured much in the word and doctrine and discipline in England, Scotland, and Ireland, turning many to God, and confirming those that were convinced of the truth, and settling good order as to church affairs among them. And towards the conclusion of his travelling services, between the years seventy- one and seventy-seven, he visited the churches of Christ in the plantations in America, and in the United Provinces, and Germany, as his following Journal relates, to the convincement and consolation of many. After that time he chiefly resided in and about the city of London, and besides the services of his ministry, which were frequent, he wrote much both to them that are within and those that are without the communion. But the care he took of the affairs of the church in general was very great. He was often where the records of the affairs of the church are kept, and the letters from the many meetings of God's people over all the world, where settled, come upon occasions; which letters he had read to him, and communicated them to the meeting that is weekly held there for such services; he would be sure to stir them up to discharge them, especially in suffering cases: showing great sympathy and compassion upon all such occasions, carefully looking into the respective cases, and endeavouring speedy relief according to the nature of them; so that the churches and any of the suffering members thereof were sure not to be forgotten or delayed in their desires if he were there. As he was unwearied, so he was undaunted in his services for God and his people; he was no more to be moved to fear than to wrath. His behaviour at Derby, Litchfield, Appleby, before Oliver Cromwell at
  • 44. Launceston, Scarborough, Worcester, and Westminster-hall, with many other places and exercises, did abundantly evidence it to his enemies as well as his friends. But as in the primitive times some rose up against the blessed apostles of our Lord Jesus Christ, even from among those that they had turned to the hope of the gospel, and who became their greatest trouble, so this man of God had his share of suffering from some that were convinced by him, who through prejudice or mistake ran against him as one that sought dominion over conscience; because he pressed, by his presence or epistles, a ready and zealous compliance with such good and wholesome things as tended to an orderly conversation about the affairs of the church, and in their walking before men. That which contributed much to this ill work, was in some a begrudging of this meek man the love and esteem he had and deserved in the hearts of the people, and weakness in others that were taken with their groundless suggestions of imposition and blind obedience. They would have had every man independent, that as he had the principle in himself, he should only stand and fall to that and nobody else; not considering that the principle is one in all, and though the measure of light or grace might differ, yet the nature of it was the same, and being so they struck at the spiritual unity, which a people guided by the same principle are naturally led into: so that what is evil to one is so to all, and what is virtuous, honest, and of good report to one, is so to all, from the sense and savour of the one universal principle which is common to all, and (which the disaffected profess to be) the root of all true Christian fellowship, and that spirit into which the people of God drink, and come to be spiritually minded, and of one heart and one soul. Some weakly mistook good order in the government of church- affairs for discipline in worship, and that it was so pressed or recommended by him and other brethren; and they were ready to reflect the same things that dissenters had very reasonably objected upon the national churches, that have coercively pressed conformity
  • 45. to their respective creeds and worships: whereas these things related wholly to conversation, and the outward and (as I may say) civil part of the church, that men should walk up to the principles of their belief, and not be wanting in care and charity. But though some have stumbled and fallen through mistakes and an unreasonable obstinacy, even to a prejudice, yet blessed be God, the generality have returned to their first love, and seen the work of the enemy, that loses no opportunity or advantage by which he may check or hinder the work of God, and disquiet the peace of His church, and chill the love of His people to the truth, and one to another; and there is hope of divers that are yet at a distance. In all these occasions, though there was no person the discontented struck so sharply at as this good man, he bore all their weakness and prejudice, and returned not reflection for reflection; but forgave them their weak and bitter speeches, praying for them that they might have a sense of their hurt, and see the subtlety of the enemy to rend and divide, and return into their first love that thought no ill. And truly, I must say, that though God had visibly cloathed him with a divine preference and authority, and indeed his very presence expressed a religious majesty, yet he never abused it, but held his place in the church of God with great meekness, and a most engaging humility and moderation. For upon all occasions, like his blessed Master, he was a servant to all, holding and exercising his eldership in the invisible power that had gathered them, with reverence to the head and care over the body, and was received only in that spirit and power of Christ, as the first and chief elder in this age; who as he was therefore worthy of double honour, so for the same reason it was given by the faithful of this day; because his authority was inward and not outward, and that he got it and kept it by the love of God and power of an endless life. I write my knowledge and not report, and my witness is true, having been with him for weeks and months together on divers occasions, and those of the nearest and most exercising nature, and that by night and by day, by sea and by land, in this and in foreign countries: and I can
  • 46. say I never saw him out of his place, or not a match for every service or occasion. For in all things he acquitted himself like a man, yea a strong man, a new and heavenly-minded man. A divine, and a naturalist, and all of God Almighty's making. I have been surprised at his questions and answers in natural things, that whilst he was ignorant of useless and sophistical science, he had in him the foundation of useful and commendable knowledge, and cherished it everywhere. Civil beyond all forms of breeding in his behaviour; very temperate, eating little and sleeping less, though a bulky person. Thus he lived and sojourned among us, and as he lived so he died, feeling the same eternal power that had raised and preserved him in his last moments. So full of assurance was he that he triumphed over death; and so even to the last, as if death were hardly worth notice or a mention: recommending to some with him the dispatch and dispersion of an epistle, just before written to the churches of Christ, throughout the world, and his own books; but above all, friends, and of all friends those in Ireland and America, twice over: saying, Mind poor friends in Ireland and America. And to some that came in and inquired how he found himself, he answered, "Never heed, the Lord's power is over all weakness and death, the Seed reigns, blessed be the Lord": which was about four or five hours before his departure out of this world. He was at the great meeting near Lombard Street on the first day of the week, and it was the third following about ten at night when he left us, being at the house of H. Goldney in the same court. In a good old age he went, after having lived to see his children's children to several generations in the truth. He had the comfort of a short illness, and the blessing of a clear sense to the last; and we may truly say with a man of God of old, that "being dead, he yet speaketh"; and though absent in body, he is present in Spirit; neither time nor place being able to interrupt the communion of saints, or dissolve the fellowship of the spirits of the just. His works praise him, because they are to the praise of Him that worked by him; for which his memorial is and
  • 47. shall be blessed. I have done, as to this part of my preface, when I have left this short epitaph to his name: "Many sons have done virtuously in this day, but, dear George, thou excellest them all."
  • 48. CONTENTS PAGE Preface, 9 Introduction, 15 The Testimony of William Penn Concerning that Faithful Servant, George Fox, 46 I. —Boyhood—A Seeker, 65 1624-1648. II. —The First Years of Ministry, 90 1648-1649. III. —The Challenge and the First Taste of Prison, 109 1648-1649. IV. —A Year in Derby Jail, 118 1650-1651. V. —One Man May Shake the Country for Ten Miles, 132 1651-1652. VI. —A New Era Begins, 150 1652. VII. —In Prison Again, 179 1653. VIII. —A Visit to Oliver Cromwell, 197 1653-1654. IX. —A Visit to the Southern Counties, Which Ends in Launceston Jail, 222 1655-1656. X. —Planting the Seed in Wales, 269 1656-1657. XI. —In the Home of the Covenanters, 297 1657.
  • 49. XII. —Great Events in London, 317 1658-1659. XIII. —In the First Year of King Charles, 331 1660. XIV. —Labors, Dangers and Sufferings, 363 1661-1662. XV. —In Prison for Not Swearing, 392 1662-1665. XVI. —A Year in Scarborough Castle, 436 1665-1666. XVII. —At the Work of Organizing, 459 1667-1670. XVIII.—Two Years in America, 482 1671-1673. XIX. —The Last Imprisonment, 536 1673-1678. XX. —The Seed Reigns over Death, 562 1679-1691. Index, 579
  • 51. CHAPTER I. Boyhood—A Seeker. 1624-1648. That all may know the dealings of the Lord with me, and the various exercises, trials, and troubles through which He led me, in order to prepare and fit me for the work unto which He had appointed me, and may thereby be drawn to admire and glorify His infinite wisdom and goodness, I think fit (before I proceed to set forth my public travels in the service of Truth) briefly to mention how it was with me in my youth, and how the work of the Lord was begun, and gradually carried on in me, even from my childhood. I was born in the month called July, 1624, at Drayton-in-the-Clay,[1] in Leicestershire. My father's name was Christopher Fox; he was by profession a weaver, an honest man; and there was a Seed of God in him. The neighbours called him Righteous Christer. My mother was an upright woman; her maiden name was Mary Lago, of the family of the Lagos, and of the stock of the martyrs.[2] In my very young years I had a gravity and stayedness of mind and spirit not usual in children; insomuch that when I saw old men behave lightly and wantonly towards each other, I had a dislike thereof raised in my heart, and said within myself, "If ever I come to be a man, surely I shall not do so, nor be so wanton." When I came to eleven years of age I knew pureness and righteousness; for while a child I was taught how to walk to be kept pure. The Lord taught me to be faithful in all things, and to act faithfully two ways, viz., inwardly, to God, and outwardly, to man; and to keep to Yea and Nay in all things. For the Lord showed me
  • 52. that, though the people of the world have mouths full of deceit, and changeable words, yet I was to keep to Yea and Nay in all things; and that my words should be few and savoury, seasoned with grace; and that I might not eat and drink to make myself wanton, but for health, using the creatures[3] in their service, as servants in their places, to the glory of Him that created them. As I grew up, my relations thought to have made me a priest,[4] but others persuaded to the contrary. Whereupon I was put to a man who was a shoemaker[5] by trade, and dealt in wool. He also used grazing, and sold cattle; and a great deal went through my hands. While I was with him he was blessed, but after I left him he broke and came to nothing. I never wronged man or woman in all that time; for the Lord's power was with me and over me, to preserve me. While I was in that service I used in my dealings the word Verily, and it was a common saying among those that knew me, "If George says verily, there is no altering him." When boys and rude persons would laugh at me, I let them alone and went my way; but people had generally a love to me for my innocency and honesty. When I came towards nineteen years of age, being upon business at a fair, one of my cousins, whose name was Bradford, having another professor[6] with him, came and asked me to drink part of a jug of beer with them. I, being thirsty, went in with them for I loved any who had a sense of good, or that sought after the Lord. When we had drunk a glass apiece, they began to drink healths, and called for more drink, agreeing together that he that would not drink should pay all. I was grieved that any who made profession of religion should offer to do so. They grieved me very much, having never had such a thing put to me before by any sort of people. Wherefore I rose up, and, putting my hand in my pocket, took out a groat, and laid it upon the table before them, saying, "If it be so, I will leave you."
  • 53. So I went away; and when I had done my business returned home; but did not go to bed that night, nor could I sleep, but sometimes walked up and down, and sometimes prayed and cried to the Lord, who said unto me: "Thou seest how young people go together into vanity, and old people into the earth; thou must forsake all, young and old, keep out of all, and be as a stranger unto all." Then, at the command of God, the ninth of the Seventh month, 1643, I left my relations, and broke off all familiarity or fellowship with young or old. I passed to Lutterworth, where I stayed some time. From thence I went to Northampton, where also I made some stay; then passed to Newport-Pagnel, whence, after I had stayed awhile, I went to Barnet, in the Fourth month, called June,[7] in the year 1644. As I thus traveled through the country, professors took notice of me, and sought to be acquainted with me; but I was afraid of them, for I was sensible they did not possess what they professed. During the time I was at Barnet a strong temptation to despair came upon me. I then saw how Christ was tempted, and mighty troubles I was in. Sometimes I kept myself retired to my chamber, and often walked solitary in the Chase to wait upon the Lord. I wondered why these things should come to me. I looked upon myself, and said, "Was I ever so before?" Then I thought, because I had forsaken my relations I had done amiss against them. So I was brought to call to mind all my time that I had spent, and to consider whether I had wronged any; but temptations grew more and more, and I was tempted almost to despair; and when Satan could not effect his design upon me that way, he laid snares and baits to draw me to commit some sin, whereof he might take advantage to bring me to despair. I was about twenty years of age when these exercises came upon me; and some years I continued in that condition, in great trouble; and fain I would have put it from me. I went to many a priest to look for comfort, but found no comfort from them.
  • 54. From Barnet I went to London, where I took a lodging, and was under great misery and trouble there; for I looked upon the great professors of the city of London, and saw all was dark and under the chain of darkness. I had an uncle there, one Pickering, a Baptist; the Baptists were tender[8] then; yet I could not impart my mind to him, nor join with them; for I saw all, young and old, where they were. Some tender people would have had me stay, but I was fearful, and returned homeward into Leicestershire, having a regard upon my mind to my parents and relations, lest I should grieve them, for I understood they were troubled at my absence. Being returned[9] into Leicestershire, my relations would have had me married; but I told them I was but a lad, and must get wisdom. Others would have had me join the auxiliary band among the soldiery,[G] but I refused, and was grieved that they offered such things to me, being a tender youth. Then I went to Coventry, where I took a chamber for awhile at a professor's house, till people began to be acquainted with me, for there were many tender people in that town. After some time I went into my own country again, and continued about a year, in great sorrow and trouble, and walked many nights by myself. Then the priest of Drayton, the town of my birth, whose name was Nathaniel Stephens, came often to me, and I went often to him; and another priest sometimes came with him; and they would give place to me, to hear me; and I would ask them questions, and reason with them. This priest, Stephens, asked me why Christ cried out upon the cross, "My God, my God, why hast thou forsaken me?" and why He said, "If it be possible, let this cup pass from me; yet not my will, but thine, be done"? I told him that at that time the sins of all mankind were upon Him, and their iniquities and transgressions, with which He was wounded; which He was to bear, and to be an offering for, as He was man; but died not, as He was God; so, in that He died for all men, tasting death for every man, He was an offering for the sins of the whole world.
  • 55. This I spoke, being at that time in a measure sensible of Christ's sufferings. The priest said it was a very good, full answer, and such a one as he had not heard. At that time he would applaud and speak highly of me to others; and what I said in discourse to him on week- days, he would preach of on First-days,[10] which gave me a dislike to him. This priest afterwards became my great persecutor. After this I went to another ancient priest[H] at Mancetter, in Warwickshire, and reasoned with him about the ground of despair and temptations. But he was ignorant of my condition; he bade me take tobacco and sing psalms. Tobacco was a thing I did not love, and psalms I was not in a state to sing; I could not sing. He bade me come again, and he would tell me many things; but when I came he was angry and pettish, for my former words had displeased him. He told my troubles, sorrows, and griefs to his servants, so that it got out among the milk-lasses. It grieved me that I should have opened my mind to such a one. I saw they were all miserable comforters, and this increased my troubles upon me. I heard of a priest living about Tamworth, who was accounted an experienced man. I went seven miles to him, but found him like an empty, hollow cask. I heard also of one called Dr. Cradock, of Coventry, and went to him. I asked him the ground of temptations and despair, and how troubles came to be wrought in man? He asked me, "Who were Christ's father and mother?" I told him, Mary was His mother, and that He was supposed to be the Son of Joseph, but He was the Son of God. Now, as we were walking together in his garden, the alley being narrow, I chanced, in turning, to set my foot on the side of a bed, at which the man was in a rage, as if his house had been on fire. Thus all our discourse was lost, and I went away in sorrow, worse than I was when I came. I thought them miserable comforters, and saw they were all as nothing to me, for they could not reach my condition.
  • 56. After this I went to another, one Macham,[I] a priest in high account. He would needs give me some physic, and I was to have been let blood; but they could not get one drop of blood from me, either in arms or head (though they endeavoured to do so), my body being, as it were, dried up with sorrows, grief and troubles, which were so great upon me that I could have wished I had never been born, or that I had been born blind, that I might never have seen wickedness or vanity; and deaf, that I might never have heard vain and wicked words, or the Lord's name blasphemed. When the time called Christmas came, while others were feasting and sporting themselves I looked out poor widows from house to house, and gave them some money. When I was invited to marriages (as I sometimes was), I went to none at all; but the next day, or soon after, I would go and visit them, and if they were poor I gave them some money; for I had wherewith both to keep myself from being chargeable to others and to administer something to the necessities of those who were in need.[11] About the beginning of the year 1646, as I was going to Coventry, and approaching towards the gate, a consideration arose in me, how it was said that "All Christians are believers, both Protestants and Papists"; and the Lord opened[12] to me that if all were believers, then they were all born of God, and passed from death to life; and that none were true believers but such; and, though others said they were believers, yet they were not. At another time, as I was walking in a field on a First-day morning, the Lord opened unto me that being bred at Oxford or Cambridge was not enough to fit and qualify men to be ministers of Christ; and I wondered at it, because it was the common belief of people. But I saw it clearly as the Lord opened it unto me, and was satisfied, and admired the goodness of the Lord, who had opened this thing unto me that morning. This struck at priest Stephens's ministry, namely, that "to be bred at Oxford or Cambridge was not enough to make a man fit to be a minister of Christ." So that which opened in me I saw struck at the priest's ministry.
  • 57. But my relations were much troubled that I would not go with them to hear the priest; for I would go into the orchard or the fields, with my Bible, by myself. I asked them, "Did not the Apostle say to believers that they needed no man to teach them, but as the anointing teacheth them?" Though they knew this was Scripture, and that it was true, yet they were grieved because I could not be subject in this matter, to go to hear the priest with them. I saw that to be a true believer was another thing than they looked upon it to be; and I saw that being bred at Oxford or Cambridge did not qualify or fit a man to be a minister of Christ; what then should I follow such for? So neither them, nor any of the dissenting people, could I join with; but was as a stranger to all, relying wholly upon the Lord Jesus Christ. At another time it was opened in me that God, who made the world, did not dwell in temples made with hands. This at first seemed a strange word, because both priests and people used to call their temples, or churches, dreadful places, holy ground, and the temples of God. But the Lord showed me clearly that He did not dwell in these temples which men had commanded and set up, but in people's hearts; for both Stephen and the apostle Paul bore testimony that He did not dwell in temples made with hands, not even in that which He had once commanded to be built, since He put an end to it; but that His people were His temple, and He dwelt in them. This opened in me as I walked in the fields to my relations' house. When I came there they told me that Nathaniel Stephens, the priest, had been there, and told them he was afraid of me, for going after new lights. I smiled in myself, knowing what the Lord had opened in me concerning him and his brethren; but I told not my relations, who, though they saw beyond the priests, yet went to hear them, and were grieved because I would not go also. But I brought them Scriptures,[J] and told them there was an anointing within man to teach him, and that the Lord would teach His people Himself.
  • 58. I had also great openings concerning the things written in the Revelations; and when I spoke of them the priests and professors would say that was a sealed book, and would have kept me out of it. But I told them Christ could open the seals, and that they were the nearest things to us; for the epistles were written to the saints that lived in former ages, but the Revelations were written of things to come. After this I met with a sort of people that held women have no souls, (adding in a light manner), No more than a goose.[13] But I reproved them, and told them that was not right; for Mary said, "My soul doth magnify the Lord, and my spirit hath rejoiced in God my Saviour." Removing to another place, I came among a people that relied much on dreams. I told them, except they could distinguish between dream and dream, they would confound all together; for there were three sorts of dreams; multitude of business sometimes caused dreams, and there were whisperings of Satan in man in the night season; and there were speakings of God to man in dreams. But these people came out of these things, and at last became Friends. [14] Now, though I had great openings, yet great trouble and temptation came many times upon me; so that when it was day I wished for night, and when it was night I wished for day; and by reason of the openings I had in my troubles, I could say as David said, "Day unto day uttereth speech, and night unto night showeth knowledge." When I had openings they answered one another and answered the Scriptures; for I had great openings of the Scriptures: and when I was in troubles, one trouble also answered to another. About the beginning of the year 1647 I was moved of the Lord to go into Derbyshire, where I met with some friendly people, and had many discourses with them. Then, passing into the Peak country,[15] I met with more friendly people, and with some in empty high notions.[16] Travelling through some parts of Leicestershire, and into Nottinghamshire, I met with a tender people, and a very tender
  • 59. woman, whose name was Elizabeth Hooton.[17] With these I had some meetings and discourses; but my troubles continued, and I was often under great temptations. I fasted much, walked abroad in solitary places many days, and often took my Bible, and sat in hollow trees and lonesome places till night came on; and frequently in the night walked mournfully about by myself; for I was a man of sorrows in the time of the first workings of the Lord in me. During all this time I was never joined in profession of religion with any, but gave up myself to the Lord, having forsaken all evil company, taken leave of father and mother, and all other relations, and travelled up and down as a stranger in the earth, which way the Lord inclined my heart; taking a chamber to myself in the town where I came, and tarrying, sometimes more, sometimes less, in a place. For I durst not stay long in a place, being afraid both of professor and profane, lest, being a tender young man, I should be hurt by conversing much with either. For this reason I kept much as a stranger, seeking heavenly wisdom and getting knowledge from the Lord, and was brought off from outward things to rely on the Lord alone. Though my exercises and troubles were very great, yet were they not so continual but that I had some intermissions, and I was sometimes brought into such an heavenly joy that I thought I had been in Abraham's bosom. As I cannot declare the misery I was in, it was so great and heavy upon me, so neither can I set forth the mercies of God unto me in all my misery. O the everlasting love of God to my soul, when I was in great distress! When my troubles and torments were great, then was His love exceeding great. Thou, Lord, makest a fruitful field a barren wilderness, and a barren wilderness a fruitful field! Thou bringest down and settest up! Thou killest and makest alive! all honour and glory be to thee, O Lord of Glory! The knowledge of Thee in the Spirit is life; but that knowledge which is fleshly works death.[18]
  • 60. While there is this knowledge in the flesh, deceit and self will conform to anything, and will say Yes, Yes, to that it doth not know. The knowledge which the world hath of what the prophets and apostles spake, is a fleshly knowledge; and the apostates from the life in which the prophets and apostles were have got their words, the Holy Scriptures, in a form, but not in the life nor spirit that gave them forth. So they all lie in confusion; and are making provision for the flesh, to fulfil the lusts thereof, but not to fulfil the law and command of Christ in His power and Spirit. For that they say they cannot do; but to fulfil the lusts of the flesh, that they can do with delight. Now, after I had received that opening from the Lord, that to be bred at Oxford or Cambridge was not sufficient to fit a man to be a minister of Christ, I regarded the priests less, and looked more after the Dissenting people.[K] Among them I saw there was some tenderness; and many of them came afterwards to be convinced, for they had some openings. But as I had forsaken the priests, so I left the separate preachers also, and those esteemed the most experienced people; for I saw there was none among them all that could speak to my condition. When all my hopes in them and in all men were gone, so that I had nothing outwardly to help me, nor could I tell what to do, then, oh, then, I heard a voice which said, "There is one, even Christ Jesus, that can speak to thy condition";[19] and when I heard it, my heart did leap for joy. Then the Lord let me see why there was none upon the earth that could speak to my condition, namely, that I might give Him all the glory. For all are concluded under sin, and shut up in unbelief, as I had been; that Jesus Christ might have the pre-eminence, who enlightens, and gives grace, and faith, and power. Thus when God doth work, who shall hinder it? and this I knew experimentally. My desire after the Lord grew stronger, and zeal in the pure knowledge of God, and of Christ alone, without the help of any man, book, or writing. For though I read the Scriptures that spoke of
  • 61. Christ and of God, yet I knew Him not, but by revelation, as He who hath the key did open, and as the Father of Life drew me to His Son by His Spirit. Then the Lord gently led me along, and let me see His love, which was endless and eternal, surpassing all the knowledge that men have in the natural state, or can obtain from history or books; and that love let me see myself, as I was without Him. I was afraid of all company, for I saw them perfectly where they were, through the love of God, which let me see myself. I had not fellowship with any people, priests or professors, or any sort of separated people, but with Christ, who hath the key, and opened the door of Light and Life unto me. I was afraid of all carnal talk and talkers, for I could see nothing but corruptions, and the life lay under the burthen of corruptions. When I myself was in the deep, shut up under all, I could not believe that I should ever overcome; my troubles, my sorrows, and my temptations were so great that I thought many times I should have despaired, I was so tempted. But when Christ opened to me how He was tempted by the same devil, and overcame him and bruised his head, and that through Him and His power, light, grace, and Spirit, I should overcome also, I had confidence in Him; so He it was that opened to me when I was shut up and had no hope nor faith. Christ, who had enlightened me, gave me His light to believe in; He gave me hope, which He Himself revealed in me, and He gave me His Spirit and grace, which I found sufficient in the deeps and in weakness. Thus, in the deepest miseries, and in the greatest sorrows and temptations, that many times beset me, the Lord in His mercy did keep me. I found that there were two thirsts in me—the one after the creatures, to get help and strength there, and the other after the Lord, the Creator, and His Son Jesus Christ. I saw all the world could do me no good; if I had had a king's diet, palace, and attendance, all would have been as nothing; for nothing gave me comfort but the
  • 62. Lord by His power. At another time I saw the great love of God, and was filled with admiration at the infiniteness of it. One day, when I had been walking solitarily abroad, and was come home, I was taken up in the love of God, so that I could not but admire the greatness of His love; and while I was in that condition, it was opened unto me by the eternal light and power, and I therein clearly saw that all was done and to be done in and by Christ, and how He conquers and destroys this tempter the devil, and all his works, and is atop of him; and that all these troubles were good for me, and temptations for the trial of my faith, which Christ had given me. The Lord opened me, that I saw all through these troubles and temptations. My living faith was raised, that I saw all was done by Christ the life, and my belief was in Him. When at any time my condition was veiled, my secret belief was stayed firm, and hope underneath held me, as an anchor in the bottom of the sea, and anchored my immortal soul to its Bishop, causing it to swim above the sea, the world, where all the raging waves, foul weather, tempests and temptations are. But O! then did I see my troubles, trials, and temptations more clearly than ever I had done. As the light appeared all appeared that is out of the light; darkness, death, temptations, the unrighteous, the ungodly; all was manifest and seen in the light. I heard of a woman in Lancashire that had fasted two and twenty days, and I travelled to see her; but when I came to her I saw that she was under a temptation. When I had spoken to her what I had from the Lord, I left her, her father being one high in profession. Passing on, I went among the professors at Duckingfield and Manchester, where I stayed awhile, and declared truth among them. There were some convinced who received the Lord's teaching, by which they were confirmed and stood in the truth. But the professors were in a rage, all pleading for sin and imperfection, and could not endure to hear talk of perfection, and of a holy and sinless
  • 63. life.[20] But the Lord's power was over all, though they were chained under darkness and sin, which they pleaded for, and quenched the tender thing in them. About this time there was a great meeting of the Baptists, at Broughton, in Leicestershire, with some that had separated from them, and people of other notions went thither, and I went also. Not many of the Baptists came, but many others were there. The Lord opened my mouth, and the everlasting truth was declared amongst them, and the power of the Lord was over them all. For in that day the Lord's power began to spring, and I had great openings in the Scriptures. Several were convinced in those parts and were turned from darkness to light, from the power of Satan unto God, and many were raised up to praise God. When I reasoned with professors and other people, some became convinced. I went back into Nottinghamshire, and there the Lord showed me that the natures of those things, which were hurtful without, were within, in the hearts and minds of wicked men. The natures of dogs, swine, vipers, of Sodom and Egypt, Pharaoh, Cain, Ishmael, Esau, etc.; the natures of these I saw within, though people had been looking without. I cried to the Lord, saying, "Why should I be thus,[L] seeing I was never addicted to commit those evils?" and the Lord answered, "That it was needful I should have a sense of all conditions, how else should I speak to all conditions!" and in this I saw the infinite love of God. I saw, also, that there was an ocean of darkness and death; but an infinite ocean of light and love, which flowed over the ocean of darkness. In that also I saw the infinite love of God, and I had great openings. Then came people from far and near to see me; but I was fearful of being drawn out by them; yet I was made to speak, and open things to them. There was one Brown, who had great prophecies and sights upon his death-bed of me. He spoke only of what I should be made instrumental by the Lord to bring forth. And of others he
  • 64. spoke, that they should come to nothing, which was fulfilled on some, who then were something in show. When this man was buried a great work of the Lord fell upon me, to the admiration of many, who thought I had been dead, and many came to see me for about fourteen days. I was very much altered in countenance and person, as if my body had been new moulded or changed.[21] My sorrows and troubles began to wear off, and tears of joy dropped from me, so that I could have wept night and day with tears of joy to the Lord, in humility and brokenness of heart. I saw into that which was without end, things which cannot be uttered, and of the greatness and infinitude of the love of God, which cannot be expressed by words. For I had been brought through the very ocean of darkness and death, and through and over the power of Satan, by the eternal, glorious power of Christ; even through that darkness was I brought, which covered over all the world, and which chained down all and shut up all in death. The same eternal power of God, which brought me through these things, was that which afterwards shook the nations, priests, professors and people. Then could I say I had been in spiritual Babylon, Sodom, Egypt, and the grave; but by the eternal power of God I was come out of it, and was brought over it, and the power of it, into the power of Christ. I saw the harvest white, and the seed of God lying thick in the ground, as ever did wheat that was sown outwardly, and none to gather it; for this I mourned with tears. A report went abroad of me, that I was a young man that had a discerning spirit; whereupon many came to me, from far and near, professors, priests, and people. The Lord's power broke forth, and I had great openings and prophecies, and spoke unto them of the things of God, which they heard with attention and silence, and went away and spread the fame thereof. Then came the tempter and set upon me again, charging me that I had sinned against the Holy Ghost; but I could not tell in what. Then
  • 65. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade 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. Let us accompany you on the journey of exploring knowledge and personal growth! textbookfull.com