curve icon indicating copy to clipboard operation
curve copied to clipboard

curvefs/client: cancel the warm-up task in the warm-up queue

Open wuhongsong opened this issue 3 years ago • 31 comments
trafficstars

Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)

cancel the warm-up task in the warm-up queue

Describe the solution you'd like (描述你期望的解决方法)

  1. what is warmup?

Before we are ready to access the file, we can pre-load the data locally

  1. how to warmup

Iterate over all files and download all s3 objects according to the chunk information in the inode

  1. What are we going to do with this task

all warm-up task is store in the warmUpTasks_ queue which is the member of class FuseClient, so if we had received the cmd to cancel the tash, we can remove it

wuhongsong avatar Nov 03 '22 07:11 wuhongsong

anybody want do it?

wuhongsong avatar Dec 13 '22 03:12 wuhongsong

Hello, Can I try this one?

Tom-CaoZH avatar Feb 06 '23 08:02 Tom-CaoZH

Hello, Can I try this one?

Okay, thanks for contributing to curve.

ilixiaocui avatar Feb 06 '23 09:02 ilixiaocui

Hello, Can I try this one?

you can take a look: https://github.com/opencurve/curve/pull/2234

Cyber-SiKu avatar Feb 06 '23 09:02 Cyber-SiKu

Hello, Can I try this one?

you can take a look: #2234

Thanks for your suggestions.

Tom-CaoZH avatar Feb 06 '23 09:02 Tom-CaoZH

@Cyber-SiKu Hi, It seems that #2234 is still under construction, so maybe I need to wait until you done, then I will implement this feature based on your code.

After viewing the related code(mainly the modified version), I roughly know how to implement this and let me give you a quick idea here so that you can correct me timely. In your code(the modified version), the WarmupFileList represents the task and the WarmupInodes represnts the needed warm-up files in a task. So If I need to cancel the warm-up task in the warm-up queue, maybe I just need to add a function in 'WarmupManager' and its derived class(now here is one: 'WarmupManagerS3Impl'). This function is used to remove the canceled task. And Also maybe I need to add a wrapper in 'FuseClient' class so that it can be more convenient. The upper-layer application needs provide the inode of the needed-cancel task.

Tom-CaoZH avatar Feb 06 '23 17:02 Tom-CaoZH

@Cyber-SiKu Hi, It seems that #2234 is still under construction, so maybe I need to wait until you done, then I will implement this feature based on your code.

After viewing the related code(mainly the modified version), I roughly know how to implement this and let me give you a quick idea here so that you can correct me timely. In your code(the modified version), the WarmupFileList represents the task and the WarmupInodes represnts the needed warm-up files in a task. So If I need to cancel the warm-up task in the warm-up queue, maybe I just need to add a function in 'WarmupManager' and its derived class(now here is one: 'WarmupManagerS3Impl'). This function is used to remove the canceled task. And Also maybe I need to add a wrapper in 'FuseClient' class so that it can be more convenient. The upper-layer application needs provide the inode of the needed-cancel task.

heroes see alike. The warm-up task is added by setting xattr, and functions such as cancellation can also be implemented in the same way.

Cyber-SiKu avatar Feb 07 '23 02:02 Cyber-SiKu

@Cyber-SiKu

wuhongsong avatar Feb 15 '23 07:02 wuhongsong

@Tom-CaoZH 2234 has been merged, can you continue?

Cyber-SiKu avatar Mar 13 '23 02:03 Cyber-SiKu

@Tom-CaoZH Are you still interested in this issue?

Cyber-SiKu avatar Mar 24 '23 08:03 Cyber-SiKu

@Cyber-SiKu Yes, but unfortunately, I have to finish my paper first as it is due on 3.30. I have been pretty busy lately , before the paper, I just finished my final exam, so I didn't have enough time to work on the project these days. But I believe I can come back as I finish the paper.

Tom-CaoZH avatar Mar 24 '23 09:03 Tom-CaoZH

@Cyber-SiKu Yes, but unfortunately, I have to finish my paper first as it is due on 3.30. I have been pretty busy lately , before the paper, I just finished my final exam, so I didn't have enough time to work on the project these days. But I believe I can come back as I finish the paper.

ok

Cyber-SiKu avatar Mar 24 '23 09:03 Cyber-SiKu

Hello @Cyber-SiKu , I have returned and reviewed the latest code. I have some ideas to implement it. Firstly, I plan to implement RemoveWarmupFilelist and RemoveWarmupFile in WarmupManagerS3Impl. Next, I will create an interface in fuse_client.h to support this feature and also write a test in test_fuse_s3_client.cpp to ensure its correctness. Then, I will proceed with implementing the related functions in curve_fuse_op.cpp. I estimate that it may take me several days to complete this work, and I will keep you updated on my progress.

Tom-CaoZH avatar Mar 31 '23 15:03 Tom-CaoZH

Hello @Cyber-SiKu , I have returned and reviewed the latest code. I have some ideas to implement it. Firstly, I plan to implement RemoveWarmupFilelist and RemoveWarmupFile in WarmupManagerS3Impl. Next, I will create an interface in fuse_client.h to support this feature and also write a test in test_fuse_s3_client.cpp to ensure its correctness. Then, I will proceed with implementing the related functions in curve_fuse_op.cpp. I estimate that it may take me several days to complete this work, and I will keep you updated on my progress.

Thanks for your work, mainly want to ask if you are still continuing or have any difficulties.

Cyber-SiKu avatar Apr 03 '23 01:04 Cyber-SiKu

@Cyber-SiKu Yes, I am still continuing, I am almost done. I am a bit confused about what kind of tests I need to write in test_fuse_s3_client.cpp, can you give me some hints?

Tom-CaoZH avatar Apr 05 '23 12:04 Tom-CaoZH

Also, I want to ask when I implement RemoveWarmupFile, it seems that I need to implement two types. one for fuse_ino_t which will remove the whole thread for the fuse_inode. another for only certain path or task which I just remove the task from the related thread. I want to verify whether this is right?

Tom-CaoZH avatar Apr 05 '23 13:04 Tom-CaoZH

@Cyber-SiKu Yes, I am still continuing, I am almost done. I am a bit confused about what kind of tests I need to write in test_fuse_s3_client.cpp, can you give me some hints?

Add a warm-up task (and then block the warm-up task), and then delete and recycle resources normally. In order to block the warmup task, you can inherit the WarmupManager class, and then rewrite the method of adding the warmup task.

Cyber-SiKu avatar Apr 07 '23 02:04 Cyber-SiKu

Also, I want to ask when I implement RemoveWarmupFile, it seems that I need to implement two types. one for fuse_ino_t which will remove the whole thread for the fuse_inode. another for only certain path or task which I just remove the task from the related thread. I want to verify whether this is right?

The warm-up task takes the inode that initiated the warm-up task as the primary key, and all resources (including thread pools and other resources) that match the primary key need to be deleted. If you only delete the corresponding thread pool, other resources will be resolved by the scanning thread and generate a new thread pool.

Cyber-SiKu avatar Apr 07 '23 02:04 Cyber-SiKu

  • This issue has been chosen for community developer activities. Welcome to feel free to try it. After the PR is merged, you will receive a gift package and a certificate as a community contributor.

  • Developer Activities Registration Steps please ref https://github.com/opencurve/curve/issues/2334#issuecomment-1504723771

zhanghuidinah avatar Apr 12 '23 06:04 zhanghuidinah

我可以试试吗

xzt1590 avatar Apr 20 '23 08:04 xzt1590

我可以试试吗

yep

Cyber-SiKu avatar Apr 21 '23 06:04 Cyber-SiKu

hello,can I change the issue?

xzt1590 avatar Apr 21 '23 07:04 xzt1590

I am interested in this task, please assign it to me, thanks. @Cyber-SiKu

Xinlong-Chen avatar Apr 26 '23 11:04 Xinlong-Chen

hello,can I change the issue?

@xzt1590 What are you trying to change?

Cyber-SiKu avatar May 17 '23 05:05 Cyber-SiKu

I am interested in this task, please assign it to me, thanks. @Cyber-SiKu

welcome

Cyber-SiKu avatar May 17 '23 05:05 Cyber-SiKu

ping @Xinlong-Chen @Tom-CaoZH

What progress has been made in solving this issue?

opencurveadmin avatar May 19 '23 07:05 opencurveadmin

ping @Xinlong-Chen @Tom-CaoZH

What progress has been made in solving this issue?

be busy with ospp task, will do it in this month~

Xinlong-Chen avatar Jul 03 '23 13:07 Xinlong-Chen

@Cyber-SiKu Yes, I am still continuing, I am almost done. I am a bit confused about what kind of tests I need to write in test_fuse_s3_client.cpp, can you give me some hints?

Add a warm-up task (and then block the warm-up task), and then delete and recycle resources normally. In order to block the warmup task, you can inherit the WarmupManager class, and then rewrite the method of adding the warmup task.

How does the "overwrite method of adding the warmup task" enable us to block the thread pool? Asking because it's essential to block, and check if the cancellation effectively removes the stuck task related to the inode.

Take a test case for a warmup file cancellation operation as an example: (1) Add the warmup file. (2) Enqueue tasks into the thread pool. (3) Verify if tasks existed in the thread pool (Tasks are stuck in the thread pool) (4) Cancel the warmup file. (5) Verify that the tasks no longer exist in the thread pool.

@Cyber-SiKu

ken90242 avatar Jul 24 '23 07:07 ken90242

@Cyber-SiKu Yes, I am still continuing, I am almost done. I am a bit confused about what kind of tests I need to write in test_fuse_s3_client.cpp, can you give me some hints?

Add a warm-up task (and then block the warm-up task), and then delete and recycle resources normally. In order to block the warmup task, you can inherit the WarmupManager class, and then rewrite the method of adding the warmup task.

How does the "overwrite method of adding the warmup task" enable us to block the thread pool? Asking because it's essential to block, and check if the cancellation effectively removes the stuck task related to the inode.

Take a test case for a warmup file cancellation operation as an example: (1) Add the warmup file. (2) Enqueue tasks into the thread pool. (3) Verify if tasks existed in the thread pool (Tasks are stuck in the thread pool) (4) Cancel the warmup file. (5) Verify that the tasks no longer exist in the thread pool.

@Cyber-SiKu

I am just giving an example, blocking is to ensure that the task is still there when it is canceled. You can also use the mock function to set the return value without blocking.

Cyber-SiKu avatar Jul 24 '23 08:07 Cyber-SiKu

@Cyber-SiKu Yes, I am still continuing, I am almost done. I am a bit confused about what kind of tests I need to write in test_fuse_s3_client.cpp, can you give me some hints?

Add a warm-up task (and then block the warm-up task), and then delete and recycle resources normally. In order to block the warmup task, you can inherit the WarmupManager class, and then rewrite the method of adding the warmup task.

How does the "overwrite method of adding the warmup task" enable us to block the thread pool? Asking because it's essential to block, and check if the cancellation effectively removes the stuck task related to the inode. Take a test case for a warmup file cancellation operation as an example: (1) Add the warmup file. (2) Enqueue tasks into the thread pool. (3) Verify if tasks existed in the thread pool (Tasks are stuck in the thread pool) (4) Cancel the warmup file. (5) Verify that the tasks no longer exist in the thread pool. @Cyber-SiKu

I am just giving an example, blocking is to ensure that the task is still there when it is canceled. You can also use the mock function to set the return value without blocking.

@Cyber-SiKu I am not quite sure how to apply the mock function to the testing (in terms of ensuring that the task is still in the thread pool). Could you please provide an example to help me understand better?


Update here is my application link: https://ask.opencurve.io/t/topic/168

ken90242 avatar Jul 24 '23 23:07 ken90242