Skip to content

Sharding get started #4042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 19, 2024
Merged

Sharding get started #4042

merged 5 commits into from
Feb 19, 2024

Conversation

andreyaksenov
Copy link
Contributor

@andreyaksenov andreyaksenov commented Feb 13, 2024

@andreyaksenov andreyaksenov linked an issue Feb 13, 2024 that may be closed by this pull request
@andreyaksenov andreyaksenov force-pushed the sharding-get-started branch 22 times, most recently from 265207e to 734a3f2 Compare February 14, 2024 13:54
@andreyaksenov andreyaksenov marked this pull request as ready for review February 14, 2024 14:06
@andreyaksenov andreyaksenov force-pushed the sharding-get-started branch 3 times, most recently from e13e8ba to bd37f62 Compare February 15, 2024 07:24
@andreyaksenov andreyaksenov force-pushed the sharding-get-started branch 2 times, most recently from bd1c0c4 to 23fed1e Compare February 16, 2024 11:55
@andreyaksenov andreyaksenov requested a review from p7nov February 16, 2024 12:02
@andreyaksenov andreyaksenov force-pushed the sharding-get-started branch 4 times, most recently from 1c2465e to 7e58508 Compare February 16, 2024 12:36
Copy link
Contributor

@p7nov p7nov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see some comments from my side.


All instances are managed using the :ref:`tt <tt-cli>` administrative utility.
.. image:: /book/admin/admin_instances_dev.png
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to make a separate copy for this tutorial. If we change the pic in the admin guide, we'll definitely forget about this usage.

Copy link
Contributor Author

@andreyaksenov andreyaksenov Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the Application environment topic explicitly says that the sharded_cluster is used as a demo app:

image

So, having a separate copy of this image requires updating both images in a case the application is updated. I agree that finding usages of this image becomes complicated, but looks that this is another issue. IMO, it is better to store all images in one directory in our future docs repo, so the path will be the same for all usages.

Comment on lines +39 to +40
The :ref:`tt create <tt-create>` command can be used to create an application from a predefined or custom template.
For example, the built-in ``vshard_cluster`` template enables you to create a ready-to-run sharded cluster application.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make this an admonition for better visibility. And use a stronger wording without for example: something like tt provides a built-in template vshard_router, which enables

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't particularly like the for example wording. It's a definite an recommended way to create an exact app structure, not an random example.


2. Inside the ``instances.enabled`` directory of the created tt environment, create the ``sharded_cluster`` directory.

3. Inside ``instances.enabled/sharded_cluster``, create the following files:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe say explicitly that they are empty for now? I've started clicking the links in file descriptions to find out about their content before reading the sentence after the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Inside the empty ``instances.enabled`` directory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean creating empty files. The emptiness of instances directory is pretty obvious :)
When I see an instruction to create a file, I expect next steps with its content right away. Now we're leaving them empty, so it's better to say that it's ok for now, the content will appear later.


3. Inside ``instances.enabled/sharded_cluster``, create the following files:

- ``instances.yml`` specifies instances to run in the current environment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list look a bit inconsistent

  • Articles: with and without the in the beginning
  • Verb form: specifies and is intended to store

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

- The ``config.yaml`` file is intended to store the cluster's :ref:`configuration <configuration_overview>`.
- ``storage.lua`` is intended to store code specific for :ref:`storages <vshard-architecture-storage>`.
- ``router.lua`` is intended to store code specific for a :ref:`router <vshard-architecture-router>`.
- ``sharded_cluster-scm-1.rockspec`` includes external dependencies required by the application.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specifies looks more accurate here. I mean, you declare a name, not download the module here :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specifies application dependencies is also shorter and pretty complete)

Copy link
Contributor Author

@andreyaksenov andreyaksenov Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to specifies external dependencies because Tarantool also includes "internal" dependencies.

stores code -> contains code

Resulting configuration
***********************

The resulting cluster configuration should look as follows:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add the name config.yaml name in this sentence or the example itself for those readers who just scroll and quickly scan the page?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to:

The resulting ``config.yaml`` file should look as follows:

:end-at: local vshard
:dedent:

2. Define the ``put`` function used to write data to a storage:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like more context here: say explicitly that this function defines how the router selects the storage to write the data. And the same for reading.

Copy link
Contributor Author

@andreyaksenov andreyaksenov Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function defines how the router selects the storage to write the data

Not exactly, it does two things:

  1. Calculates a bucket ID used to write data to the correct storage.
  2. Uses this bucket ID to write data to the storage.

This is what the list after the function definition describes. I'd keep the first sentence short because too much context before the function definition makes it hard to read because of too much technical details.

Building the application
------------------------

In the terminal, open a directory where the :ref:`tt environment is created <vshard-quick-start-creating-app>`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directory where the tt environment is created > the tt environment directory?

Bootstrapping a cluster
~~~~~~~~~~~~~~~~~~~~~~~

To bootstrap the cluster, follow the steps below:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add an intro sentence that bootstrap is required? It's not obvious.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrased:

After starting instances, you need to bootstrap the cluster as follows:

Checking status
~~~~~~~~~~~~~~~

To check the cluster's status, execute :ref:`vshard.router.info() <router_api-info>` on the router:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any hints what to look at? Now it's a big unfamiliar console output that hardly helps newcomers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the description for each top-level section

@andreyaksenov andreyaksenov force-pushed the sharding-get-started branch 2 times, most recently from 43bdb3c to 808c520 Compare February 19, 2024 10:33
@andreyaksenov andreyaksenov requested a review from p7nov February 19, 2024 10:40

.. _vshard-quick-start-working-adding-selecting-data:

Adding and selecting data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Adding and selecting data
Writing and selecting data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Config] How-to: sharding configuration
4 participants