-
Notifications
You must be signed in to change notification settings - Fork 42
Deploy from url split #1715
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
Deploy from url split #1715
Conversation
ed41fe6 to
8754361
Compare
| } | ||
|
|
||
| @Bean(name = "deployFromUrlExecutor") | ||
| public ExecutorService deployFromUrlExecutor() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is needed when we have asyncFileUploadExecutor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The asyncFileUploadExecutor is used for the actual upload. It has a queue of 20 which means it can store 20 jobs in the queue before starting a new thread.
Such executor will not scale well under load it might not update the update_at column in the database and the job might be consider as stale.
The goal of deployFromUrlExecutor is to update regularly updated_at value in the table and trigger the other executor to schedule the upload.
multiapps-controller-persistence/src/main/resources/META-INF/persistence.xml
Show resolved
Hide resolved
|
|
||
| <include file="/org/cloudfoundry/multiapps/controller/persistence/db/changelog/db-changelog-1.192.0-persistence.xml"/> | ||
|
|
||
| <include file="/org/cloudfoundry/multiapps/controller/persistence/db/changelog/db-changelog-1.199.0-persistence.xml"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not forget to align the file with version which will be released
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.34.0
| // As the threads are only updating a row and waiting it is ok to have more threads | ||
| 30, | ||
| TimeUnit.SECONDS, | ||
| new SynchronousQueue<>()); // A synchronous queue is used so deploy from url jobs immediately start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if all threads are busy and there is already one task in the queue waiting for execution? What will happen with all other threads which tries to submit a new task?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This queue does not store any jobs, if there is a free thread (up to 50) it will immediately start the job, if there are no available threads (50 are used) it will reject the job. According to statistics there are maximum of around ~320 started operations on eu10-004 per hour (most use normal file upload), so 450 threads seems more than enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If backend reject file upload task, does the cli will retry on another instance or it will retry on the same one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will check in the plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, usually hit the same instance because of sticky sessions, except the last retry...
described in the backlog for the session handling
...eb/src/main/java/org/cloudfoundry/multiapps/controller/web/api/impl/FilesApiServiceImpl.java
Outdated
Show resolved
Hide resolved
...b/src/main/java/org/cloudfoundry/multiapps/controller/web/upload/AsyncUploadJobExecutor.java
Outdated
Show resolved
Hide resolved
...b/src/main/java/org/cloudfoundry/multiapps/controller/web/upload/AsyncUploadJobExecutor.java
Outdated
Show resolved
Hide resolved
...c/test/java/org/cloudfoundry/multiapps/controller/web/upload/AsyncUploadJobExecutorTest.java
Outdated
Show resolved
Hide resolved
...oudfoundry/multiapps/controller/process/configuration/FileUploadThreadPoolConfiguration.java
Show resolved
Hide resolved
d9b5cda to
403c257
Compare
.../src/main/java/org/cloudfoundry/multiapps/controller/process/stream/CountingInputStream.java
Show resolved
Hide resolved
29a1b9e to
c734c27
Compare
.../src/main/java/org/cloudfoundry/multiapps/controller/core/util/ApplicationConfiguration.java
Show resolved
Hide resolved
...e/src/main/java/org/cloudfoundry/multiapps/controller/persistence/dto/AsyncUploadJobDto.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/cloudfoundry/multiapps/controller/persistence/model/PersistenceMetadata.java
Outdated
Show resolved
Hide resolved
a56c5e5 to
d2d4196
Compare
| } finally { | ||
| lock.unlock(); | ||
| } | ||
| MiscUtil.sleep(WAIT_TIME_BETWEEN_ASYNC_JOB_UPDATES_IN_MILLIS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we try to use another approach by avoiding putting thread into sleep by using ScheduledExecutorService for monitoring and db update tasks? ScheduledExecutorService has methods to setup execution intervals and method execution delays. This is only idea, if performance is worse, then we can keep it as it is now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to introduce such an executor but I see a couple of issues with this approach.
We will have 3 executors. Currently these 2 asyncFileUploadExecutor and deployFromUrlExecutor have the same amount of maximum load they can handle:
asyncFileUploadExecutor - 6 threads max + 20 waiting jobs (6th tread is started after the 20th waiting job)
deployFromUrlExecutor - max of 26 threads so it handles the same amount of jobs, without leading to unused threads or failing jobs because the other executor is full.
If we introduce a new executor only to remove the thread sleep it also will have to be synchronized with the above mentioned. Another possible problem is, there will be always one more thread allocated to start the monitoring until the thread is freed from deployFromUrlExecutor. The bigger problem is the synchronization, the deployFromUrlExecutor should start checking the queue of the new scheduled executor so it can decide whether to handle or reject the job. In my opinion seems like unnecessary complication of the code
|
Evaluate security hotpost before merge |
LMCROSSITXSADEPLOY-3285
LMCROSSITXSADEPLOY-3285
0ae139b
1f58831 to
0ae139b
Compare
|


LMCROSSITXSADEPLOY-3285