Repository navigation
Conversation
|
Thanks for the pull request, @dwong2708! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Record a full reindex run with option A plus per-course tag prefetch on the same instance (1,688 courses, 599,897 blocks). Total time went from 5,273 s to 2,574 s, which is 5.1 times faster than the original run (13,002 s). Tag time dropped from 2,715 s to 19 s. The old cost was one tag lookup per block (about 4.5 ms each), and all of them returned nothing because the instance has no tags. Document building is now 88% of the remaining time. The instance has no tagged content, so correctness with tags is not verified (blocks_with_tags=0, verified=False). Add this caveat to the Consequences section and to the tag batching entry in Other options.
|
@rpenido, @blarghmatey: Wanted to make sure you folks also saw this, as it's search-related. |
|
Hi @dwong2708! Thanks for the ADR! We are currently working on search across the platform, creating an api that abstracts the search engine: https://github.com/openedx/openedx-search/ You can check https://github.com/openedx/openedx-search/tree/main/docs/decisions to see what we are planning. We haven't implemented the def course_documents():
for course in courses:
yield build_documents(course)
def library_documents():
for library in libraries:
yield component_documents(library)
for page in collection_pages(library):
yield collection_documents(page)
for page in container_pages(library):
yield container_documents(page)
search_api.rebuild(
"studio_content",
course_documents,
)
search_api.rebuild(
"studio_library_content",
library_documents,
)After thinking on your ADR here, I think the rebuild should look like this: # openedx_search/api.py (sketch)
MAX_IN_FLIGHT = 20
POLL_INTERVAL = 0.2
def rebuild(use_case, document_source):
# ... resolve the registration and adapter, mint the target,
# take the rebuild lease, begin_rebuild(target) ...
pending = [] # WriteReceipt, in submission order
indexed = 0
def check_all():
# One poll for the whole window. check_writes checks every receipt and
# raises WriteFailed if any task failed or was canceled.
updated = adapter.check_writes(pending)
pending[:] = [receipt for receipt in updated if not receipt.complete]
for documents in document_source():
if not documents:
continue
# Hand the batch off; no wait here while the window has room.
pending.append(adapter.upsert(documents, target=target))
indexed += len(documents)
while len(pending) >= MAX_IN_FLIGHT:
# ... refresh the lease ...
check_all()
if len(pending) >= MAX_IN_FLIGHT:
time.sleep(POLL_INTERVAL) # check_writes never sleeps; the worker does
while pending: # drain the last tasks before the swap
# ... refresh the lease ...
check_all()
if pending:
time.sleep(POLL_INTERVAL)
# ... commit_rebuild(target) on success, abort_rebuild(target) on failure ...
return RebuildResult(target=target, documents=indexed)So, the context in this ADR would probably be transferred to Also, we are not planning an incremental rebuild. |
| content, so it does not show correctness or timing when tags exist. Create | ||
| tags in a test course and compare the prefetch path with the per-block path | ||
| before relying on it. | ||
| * Library collection and container indexing in ``rebuild_index()`` can use the |
There was a problem hiding this comment.
👍
Note that currently, we are doing the "oposite": we take a list for collections and containers, put it in batches and create a task for each batch, increasing the wait time.
Resolves: #39463
Description
Adds ADR 0003,
openedx/core/djangoapps/content/search/docs/decisions/0003-bounded-in-flight-reindex-tasks.rst. It records why a full./manage.py cms reindex_studiois slow and proposes how to speed it up. This PR changes documentation only. No code, settings, or migrations change.Problem.
rebuild_index()indexes courses one at a time. After each course it calls_wait_for_meili_task(), which blocks until Meilisearch finishes that course's task. Only then does it create theIncrementalIndexCompletedrow. On a large instance (1,698 courses, 5 libraries, 599,934 blocks) a real run took 13,002 s (3 h 37 min). About 59% of that time (about 5.3 s per non-empty course) was spent waiting, not building documents.What the ADR proposes (status: Draft).
IncrementalIndexCompletedrow only after the task succeeded. This needs no migration, and a row still means "confirmed indexed". N should be configurable, and the default is to be chosen with the maintainers.task_uidonIncrementalIndexCompleted. This needs a migration.add_documentscall, concurrent document building, per-course tag batching, andbulk_operationsaroundget_course.Measurements on one instance (prototypes, not part of this PR):
reindex_studio(wait per course)No task failed in any run. The tag prefetch result came from an instance with no tagged content, so it shows the speedup but not correctness. The ADR lists this caveat and says to verify on tagged content before relying on it.
Who is affected.
No screenshots or configuration changes. The ADR says the window size should be configurable, but no setting is added here, so there is nothing to annotate.
Supporting information
Deadline
None
Other information
not by a run on the instance. Measurements come from a single instance and a single run each, so differences of
a few percent are noise.