summaryrefslogtreecommitdiffstats
path: root/src/server/uplink.c
Commit message (Collapse)AuthorAgeFilesLines
* [SERVER] Add minRequestSize: Enlarge relayed requestsSimon Rettberg2021-05-111-6/+15
| | | | | | | | | | Any request from a client being relayed to an uplink server will have its size extended to this value. It will also be applied to background replication requests, if the BGR mode is FULL. As request coalescing is currently very primitive, this setting should usually be left diabled, and bgrWindowSize used instead, if appropriate. If you enable this, set it to something large (1M+), or it might have adverse effects.
* [KERNEL] Improve debug output in net.cSimon Rettberg2021-04-201-0/+1
|
* [SERVER] Mark uplink requests with BGR/prefetch flags and handle themSimon Rettberg2021-04-141-5/+20
| | | | | | | | | Incoming requests from clients might actually be prefetch jobs from another downstream proxy. Don't do prefetching for those, as this would cascade upwars in the proxy chain (prefetch for a prefetch of a prefetch) Incoming requests might also be background replication. Don't relay those if we're not configured for background replication as well.
* [SERVER] Make prefetching synchronousSimon Rettberg2021-04-141-152/+198
| | | | | | | | | There is a race condition where we process the next request from the same client faster than the OS will schedule the async prefetch job, rendering it a NOOP in the best case (request ranges match) or fetching redundant data from the upstream server (prefetch range is larger than actual request by client). Make prefetching synchronous to prevent this race condition.
* [SERVER] Fix warningsSimon Rettberg2020-11-231-1/+2
|
* [BUILD] rewrite CMake build system to track changes of source filesManuel Bentele2020-10-161-7/+7
| | | | | | | | | | This change restructures the source code directories, separates shared form non-shared application code and adds CMake dependencies. These dependencies allow the tracking of changes and trigger a rebuild of those build targets where changed files are involved. WARNING: Note that the support of the DNBD3_SERVER_AFL build option is not supported yet. Thus, the option should be never turned on.
* [SERVER] Add FUSE modeSimon Rettberg2020-07-281-79/+67Star
| | | | | Still needs some cleanup and optimizations, variable naming sucks, comments, etc.
* [SERVER] Fix list walk when removing client from uplinkSimon Rettberg2020-06-101-1/+3
|
* [SERVER] Fix warnings, add assertionsSimon Rettberg2020-03-201-6/+9
|
* [SERVER] Add name param to threadpool_runSimon Rettberg2020-03-191-1/+1
|
* [SERVER] Make sure bgrWindowSize doesn't overwhelm uplink queueSimon Rettberg2020-03-171-0/+2
|
* [SERVER] Don't prefetch across hash blocks in BGS_HASHBLOCK modeSimon Rettberg2020-03-171-5/+8
|
* [SERVER] Remove uplink_ prefix from static (private) functionsSimon Rettberg2020-03-141-40/+40
|
* [SERVER] Add comments, assert for uplink threadSimon Rettberg2020-03-141-6/+20
|
* [SERVER] Use image:rid in log messagesSimon Rettberg2020-03-141-5/+5
|
* [SERVER] Check server version before setting hopCount fieldSimon Rettberg2020-03-131-1/+1
|
* [SERVER] Check and increase hopCount when adding uplink requestSimon Rettberg2020-03-131-4/+7
|
* [SERVER] Rewrite uplink queue handlingSimon Rettberg2020-03-131-348/+423
| | | | | | - Now uses linked lists instead of huge array - Does prefetch data on client requests - Can have multiple replication requests in-flight
* [SERVER] Add printf macro for image (name:rid as %s:%d)Simon Rettberg2020-03-061-10/+10
|
* [SERVER] Handle "warn unused result" casesSimon Rettberg2020-03-061-4/+10
|
* [SERVER] Reload cache maps periodically for local imagesSimon Rettberg2020-03-061-2/+8
| | | | | | If an image is incomplete, but has no upstream server that can be used for replication, reload the cache map from disk periodically, in case some other server instance is writing to the image.
* [SERVER] Add timer task for saving cache mapsSimon Rettberg2020-03-041-73/+3Star
| | | | | | | | | Cache maps will now be saved periodically, but only if either they have a "dirty" bit set, which happens if any bits in the map get cleared again (due to corruption), or if new data has been replicated from an uplink server. This either means at least one byte received and 5 minutes have passed, or at least 500MB have been downloaded. The timer currently runs every 20 seconds.
* [SERVER] Also add a flag for uplink queue overloadSimon Rettberg2020-03-031-0/+11
|
* [SERVER] Remove "working" flag, introduce fine-grained flagsSimon Rettberg2020-03-031-38/+76
| | | | | | | | Tracking the "working" state of images using one boolean is insufficient regarding the different ways in which providing an image can fail. Introduce separate flags for different conditions, like "file not readable", "file not writable", "no uplink server available", "file content has changed".
* [SERVER] Fix warning on clangSimon Rettberg2019-09-071-6/+1Star
|
* [SERVER] integrity checker: Improve flushing logicSimon Rettberg2019-09-051-1/+1
|
* [SERVER] Move signal init to uplink_initSimon Rettberg2019-09-021-10/+11
| | | | | | | Initializing the signal in the thread lead to a race where we would init the uplink and queue a request for it before the thread actually initialized it. This was not harmful but lead to spurious warnings in the server's log.
* [SERVER] uplink: Don't disable already disabled imageSimon Rettberg2019-09-021-1/+1
|
* [SERVER] uplink: Don't reinit uplink when freeing itSimon Rettberg2019-09-021-13/+3Star
|
* [SERVER] Less debug spam, fix RTT interval calculationSimon Rettberg2019-08-301-3/+5
|
* [SERVER] Introduce debug spamSimon Rettberg2019-08-301-8/+8
|
* [SERVER] No uplink_init when checking working state; improve loggingSimon Rettberg2019-08-301-0/+1
|
* [SERVER] Tear down whole uplink on idle timeoutSimon Rettberg2019-08-291-21/+19Star
| | | | | | Keeping the uplink thread around forever even though we disconnected from the upstream server seems wasteful. Get rid of this and rear down the uplink entirely.
* [SERVER] Use weakref for cache mapsSimon Rettberg2019-08-291-34/+30Star
| | | | | | Gets rid of a bunch of locking, especially the hot path in net.c where clients are requesting data. Many clients unsing the same incomplete image previously created a bottleneck here.
* [SERVER] Fix swapped assignmentSimon Rettberg2019-08-271-1/+1
|
* [SERVER] Use reference counting for uplinkSimon Rettberg2019-08-271-88/+126
| | | | First step towards less locking for proxy mode
* [SERVER] Fix warnings, simplify lockingSimon Rettberg2019-08-261-11/+12
|
* [SERVER] Get rid of alt-servers thread, per-uplink rtt historySimon Rettberg2019-08-221-56/+61
| | | | | | | | | | Alt-Server checks are now run using the threadpool, so we don't need a queue and dedicated thread anymore. The rtt history is now kept per uplink, so many uplinks won't overwhelm the history, making its time window very short. Also the fail counter is now split up; a global one for when the server actually isn't reachable, a local (per-uplink) one for when the server is reachable but doesn't serve the requested image.
* [SERVER] Add struct representing active connection to uplink serverSimon Rettberg2019-08-181-40/+38Star
|
* [SERVER] uplink: More consistent type/variable namingSimon Rettberg2019-08-181-277/+277
| | | | | * Change link to uplink everywhere * dnbd3_connection_t -> dnbd3_uplink_t
* [SERVER] Better lock debugging: Always check lock orderSimon Rettberg2019-08-071-3/+3
| | | | | | Lock order is predefined in locks.h. Immediately bail out if a lock with lower priority is obtained while the same thread already holds one with higher priority.
* [SERVER] Lock-free queue for altservers check threadSimon Rettberg2019-08-071-4/+4
|
* [SERVER] uplink: Improve attaching to existing requestsSimon Rettberg2019-08-061-23/+74
| | | | | Allow attaching in ULR_PROCESSING state, leave lower slots empty to increase chances attaching to ULR_PROCESSING.
* [SERVER] Fix: Client thread could destroy sendMutex while in useSimon Rettberg2019-08-061-0/+3
| | | | | | Fix a race condition where the client thread tears down the client struct including the sendMutex while the uplink thead is currently holding the lock, trying to send data to the client.
* [SERVER] Allow uplink shutdown if bgrMinClients > image->usersSimon Rettberg2019-08-051-1/+2
|
* [SERVER] Turn all spinlocks into mutexesSimon Rettberg2019-07-261-94/+94
| | | | | | | | Just assume sane platforms offer smart mutexes that have a fast-path with spinlocks internally for locks that have little to no congestion. In all other cases, mutexes should perform better anyways.
* [SERVER] uplink: Relay request in client's thread if possibleSimon Rettberg2019-07-231-3/+56
| | | | | Early benchmarking shows that this is faster, since we don't require another thread to wake up just to send out the request.
* [SERVER] Don't shutdown uplink if background replication is FULLSimon Rettberg2019-02-131-1/+1
|
* [SERVER] uplink: Dedicated function for handling link failureSimon Rettberg2019-02-081-31/+50
|
* [SERVER] Don't keep an uplink connection established foreverSimon Rettberg2019-01-311-38/+70
| | | | | | In case we don't use background replication a connection to an uplink server can potentially stay around forever. This in turn would prevent the uplink server from freeing the image as it appears to be in use.